I want to add to @ingomueller.net's answer. CMake does have .s
targets but for multi directory projects, you have to navigate to the right directory within your build directory to get it. That directory is determined by the location of the CMakeLists.txt
file that creates the target and the add_subdirectory()
commands that get to it.
If
<source_dir>/<d1>/CMakeLists.txt
has
add_excutable(x <d2>/file.c)
#or
add_library(x <d2>/file.c)
Then you can run make <d2>/file.s
if you go to the right directory first.
In general, this will be the value of ${CMAKE_CURRENT_BINARY_DIR}
where the target is created. In most cases this would be
<build_dir>/<d1>
But this can be different because add_subdirectory()
can take two arguments which can change things. For example, say <d1>
is a/b
, if the toplevel CMakeLists.txt does add_subdirectory(a/b/ c)
, then you will need to go to <build_dir>/c
. Also the second argument of add_subdirectory can be an absolute path. And since we can get to the CMakeLists.txt
file that creates the target through multiple add_subdirectory()
commands, the only general answer is "whatever the value of ${CMAKE_CURRENT_BINARY_DIR}
is where the target is created".
CMake will print the path to the generated file which will be CMakeFiles/<target_name>.dir/<d2>/file.c.s
relative to $PWD
.
Also, note that you can do either make <d2>/file.s
or make <d2>/file.c.s
and both will generate the file file.c.s
however you could have file.c
and file.f90
in the same directory, in that case make <d2>/file.s
will generate two files file.c.s
and file.f90.s
but doing make <d2>/file.c.s
will generate just one.