> > However, whatever I write into 'set_property()' - no APPEND, single entry, > > not quoted - does not end up > > on the compiler command line. Is there a type mismatch which is silently > > ignored? > > > > Or you are doing this in a directory which is not the one where the target > is defined and from the doc: > $ cmake --help-command set_property > > ... > ``SOURCE`` > Scope may name zero or more source files. Note that source > file properties are visible only to targets added in the same > directory (CMakeLists.txt). > > ...
This is all in the same directory, full setup and test: % cmake --version cmake version 3.12.0 [..] % mkdir mylib && cd mylib mylib% touch file1.c file2.c mylib% cat > CMakeLists.txt cmake_minimum_required(VERSION 3.12) add_library(mylib SHARED file1.c file2.c) get_property(mysrcs TARGET mylib PROPERTY SOURCES) foreach(x IN LISTS mysrcs) message("at ${x}") set_property(SOURCE x APPEND PROPERTY COMPILE_DEFINITIONS "TEST1;TEST2;") endforeach(x) # ^D mylib% mkdir build && cd build && cmake .. [..] at file1.c at file2.c -- Configuring done [..] mylibs/build% grep -r TEST1 . || echo no TEST1 no TEST1 and 'make VERBOSE=1' also shows no extra -DTEST1 compiler arguments. -- 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