How would one set a variable containing multiple definitions to be passed to target_compile_definitions() ?
From: Chuck Atkins <chuck.atk...@kitware.com> Date: Friday, October 12, 2018 at 1:45 PM To: Rob Boehne <r...@datalogics.com> Cc: CMake Mail List <cmake@cmake.org> Subject: Re: [CMake] Building arguments to target_comple_definitions() So in CMake parlance, what type is the last argument to target_compile_definitions? Is it a list, string or something else? It's a series of VISIBILITY_SPECIFIER DEF1 DEF2 ... DEFN, so the visibility specifier followed by a list of definitions, optionally followed by another visibility specifier and list of definitions, etc. add_library(Foo OBJECT Foo.cxx) target_compile_definitions(Foo PUBLIC COMMON_DEF_1 COMMON_DEF_2 PRIVATE FOO_SPECIFIC_DEF=42 ) will translate to something like: c++ -DCOMMON_DEF_1 -DCOMMON_DEF_2 -DFOO_SPECIFIC_DEF=4 -o Foo.cxx.o -c Foo.cxx - Chuck From: Chuck Atkins <chuck.atk...@kitware.com<mailto:chuck.atk...@kitware.com>> Date: Thursday, October 11, 2018 at 2:55 PM To: Rob Boehne <r...@datalogics.com<mailto:r...@datalogics.com>> Cc: CMake Mail List <cmake@cmake.org<mailto:cmake@cmake.org>> Subject: Re: [CMake] Building arguments to target_comple_definitions() 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 That's certainly one way you can solve the problem, i.e. making an interface library with the common defs, and a good idea at that, but that's not what I was referring to. I was simply tying to explain that the error your getting trying to pass arguments to target_compile_options is because you're missing the visibility argument. - 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