[CMake] help with learning add_library
luxInteg
lux-integ at btconnect.com
Mon Nov 8 13:57:11 EST 2010
On Saturday 06 November 2010 23:08:29 Eric Noulard wrote:
>
> I think you cannot use **the same** file properties on a source file
> and expect CMake will compile the file twice for the same target.
> If you want to compile the same source file twice with different compile
> flags **FOR THE SAME TARGET** you have to copy this file
>
> SET_SOURCE_FILES_PROPERTIES(file1-long.c PROPERTIES
> COMPILE_DEFINITIONS "-DLONG")
> ** same for file 2 **
> ADD_LIBRARY(LearnCMAKE-static STATIC file1.c file1-long.c file2.c
> file2-long.c) ADD_LIBRARY(LearnCMAKE-shared SHARED file1.c file1-long.c
> file2.c file2-long.c)
BUT
suppose I decide to set file1.c and file2.c as some variable "FILES" and I
want to use a preprocessor say DLONG
could I do the following?
set(FILES file1.c file2.c )
SET_SOURCE_FILES_PROPERTIES(${FILES} PROPERTIES COMPILE_DEFINITIONS "-DLONG")
More information about the CMake
mailing list