Vivek Goel
Vivek Goel

Reputation: 24160

CMAKe library level CFLAGS

I have project of following struct

 A 
   CMakeLists.txt
 B 
   CMakeLists.txt
 C
   CMakeLists.txt

I directory level CFLAGS .

so what CFLAGS A uses to compile will be only used for A only.

How can I set directory level or (sub project level ) CFLAGS using cmake

Upvotes: 0

Views: 1780

Answers (1)

arrowd
arrowd

Reputation: 34411

You can do following:

set_source_files_properties(file1.c file2.c
    PROPERTIES COMPILE_FLAGS ${YOUR_CFLAGS_HERE}
)

Still, it's recommended to use add_definitions(), include_directories(), link_directories() and so on.

if any of these functions will be called in A/CMakeLists.txt, they will not have any effect on {B,C}/CMakeLists.txt.

Upvotes: 1

Related Questions