[CMake] missing .S (assembly file) target

Michael Hertling mhertling at online.de
Tue Sep 20 13:11:58 EDT 2011


On 09/20/2011 08:46 AM, Reto Glauser wrote:
> Hi
> 
> I don't see the .S targets (for C/CXX files) which used to be there. I 
> would like to look at the assembly files of the C/CXX files.
> 
> I'm on
> 
> GNU/Linux
> GCC-4.3.4
> CMake-2.8.2

With CMake 2.8.5 on Linux, I can't confirm this:

CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR)
PROJECT(ASSEMBLER C CXX)
SET(CMAKE_VERBOSE_MAKEFILE ON)
FILE(WRITE ${CMAKE_BINARY_DIR}/main.c "int main(void){return 0;}\n")
ADD_EXECUTABLE(main main.c)
FILE(WRITE ${CMAKE_BINARY_DIR}/mainxx.cxx "int main(void){return 0;}\n")
ADD_EXECUTABLE(mainxx mainxx.cxx)

After configuring, "make help" reveals:

% make help
The following are some of the valid targets for this Makefile:
... all (the default if no target is provided)
... clean
... depend
... edit_cache
... main
... mainxx
... rebuild_cache
... main.o
... main.i
... main.s
... mainxx.o
... mainxx.i
... mainxx.s

A "make main.s mainxx.s" results in:

% make main.s mainxx.s
...
Compiling C source to assembly CMakeFiles/main.dir/main.c.s
.../gcc -S .../main.c -o CMakeFiles/main.dir/main.c.s
...
Compiling CXX source to assembly CMakeFiles/mainxx.dir/mainxx.cxx.s
.../c++ -S .../mainxx.cxx -o CMakeFiles/mainxx.dir/mainxx.cxx.s

% ls CMakeFiles/main{,xx}.dir/*.s
CMakeFiles/main.dir/main.c.s  CMakeFiles/mainxx.dir/mainxx.cxx.s

Don't the *.s files appear as targets in your CMake-generated
Makefiles, or aren't they the files you are interested in?

Regards,

Michael

> Adding
> 
> enable_language(ASM)
> SET (CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> <FLAGS> -S 
> <SOURCE> -o <ASSEMBLY_SOURCE>")
> 
> before the project doesn't help.
> 
> Any ideas?
> 
> Thanks


More information about the CMake mailing list