[CMake] Parameter LANGUAGE in set_source_files_properties
Eric Noulard
eric.noulard at gmail.com
Mon Jul 7 04:45:00 EDT 2008
2008/7/7 <zia at itsib.ru>:
> I have a little problem.
> I have project's tree and several files with c extension and I want
> to compile one file by g++ compiler and not c compiler.
>
> ./Trunk
> |
> ->TEST
> |
> ->test.c
> ->test1.c
> ->test2.c
> ->CMakeLists.txt
> |
> ->CMakeLists.txt
>
> ---------------------------------------------
> I make in root CMakeLists.txt
> PROJECT (TEST C CXX)
>
> add_executable(myexe ${COMMON_SRC})
> ---------------------------------------------
> and CMakeLists.txt in TEST's folder
>
> SET(COMMON_SRC
> test.c
> test1.c
> )
>
> SET_SOURCE_FILES_PROPERTIES(
> test2.c
> PROPERTIES
> LANGUAGE CXX
> )
>
> test.c and test1.c files are right compiling by C cmpiler but test2.c is not compile CXX compiler this file is not build at all.
> What do I do wrong?
test2.c is not compiled because it does not appear in either
ADD_EXECUTABLE
or
ADD_LIBRARY
add it to something to be built and it will be compiled.
the SET_SOURCE_FILES_PROPERTIES only tells CMake that
"if" the file needs to be compiled then it should use a C++ compiler.
--
Erk
More information about the CMake
mailing list