[CMake] add_custom_command using CMAKE_CXX_FLAGS

John Smith codeforgenator at gmail.com
Mon Sep 7 11:53:54 EDT 2009


On Sep 5, 2009, at 3:31 PM, Alexander Neundorf wrote:
> [...]
> Can you please try the attached patch ?

I have tried it and I have got the desired result, i.e. the compiler  
driver is invoked for compilation on the assembly sources. The  
CMakeLists.txt file contains:

ENABLE_LANGUAGE(ASM-GCC)
set (ASM_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/asm.S)
add_library (mylib ${CXX_LIBRARY_TYPE} somesrc.cpp ${ASM_SRCS})

which results in:

[  2%] Building ASM-GCC object .../asm.S.o
cd projdir && /usr/bin/gcc  -Isomeinclude -c asm.S -o bindir/asm.S.o

As I said before, and after more thinking, I believe that in my case a  
better solution is to have the assembly source compiled like the other  
sources in the project. This might not be the ideal solution for other  
projects.

So, a better solution for me is to have:

set_source_files_properties (${ASM_SRCS} PROPERTIES LANGUAGE CXX)

Thanks!

-J



More information about the CMake mailing list