So, are you suggesting that I make a “dummy” target and fill it with the common 
options in compile_definitions() and include_directories() (et. al.)
Then make my OBJECT libraries (and the shared library) depend on the “dummy” 
target?

If that’s not the suggestion, I’m afraid I don’t see how I can use this to set 
the common flags


From: Chuck Atkins <chuck.atk...@kitware.com>
Date: Thursday, October 11, 2018 at 2:12 PM
To: Rob Boehne <r...@datalogics.com>
Cc: CMake Mail List <cmake@cmake.org>
Subject: Re: [CMake] Building arguments to target_comple_definitions()

Hi Rob,

target_compile_definitions( CHUNK1 ${COMMON_DEFINITIONS}  CHUNK1_STUFF 
CHUNK_NAME=\”One\” )
target_compile_definitions( CHUNK2 ${COMMON_DEFINITIONS}  CHUNK2_STUFF 
CHUNK_NAME=\”Two\”)
target_compile_definitions( FooBar ${COMMON_DEFINITIONS}  )

This is what I was referring to.  Adding visibility to 
target_compile_definitions:

target_compile_definitions(CHUNK1 PRIVATE ${COMMON_DEFINITIONS} CHUNK1_STUFF 
CHUNK_NAME=\"One\")
target_compile_definitions(CHUNK2 PRIVATE ${COMMON_DEFINITIONS} CHUNK2_STUFF 
CHUNK_NAME=\"Two\")
target_compile_definitions(FooBar PRIVATE ${COMMON_DEFINITIONS})

All of the target_<foo> commands take the format target_foo(target_name 
USAGE_VISIBILY bar1 bar2 bar3 ...).  target_link_libraries is the exception 
with everythign being PUBLIC by default but only because it pre-dates all the 
other target commands.

- Chuck
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake

Reply via email to