Hi,
in my project I used such magic code for precompiled headers support
(gcc,clang only):
#take gcc_flags from
${CMAKE_CXX_FLAGS}
${CMAKE_CXX_FLAGS_${_build_type}}
get_target_property(... COMPILE_FLAGS)
get_directory_property(...
INCLUDE_DIRECTORIES) foreach(flag
${MY_INCLUDES})
list(APPEND gcc_flags "-I" "${pl_flag}")
endforeach()
get_directory_property(... COMPILE_DEFINITIONS)
foreach(flag ${MY_DEFS})
list(APPEND gcc_flags "-D${pl_flag}")
endforeach()
get_directory_property(...
COMPILE_DEFINITIONS_${_build_type}) add_custom_command(...
${gcc_flags} ...)
All works fine, until cmake-3.0 with cmake-generator-expressions.
With cmake-3.0 COMPILE_DEFINITIONS return something like this:
$<$<NOT:$<CONFIG:Debug>>:QT_NO_DEBUG>
This is empty string on compilation stage, not on not configuration
stage. So "gcc" is called like this: "gcc -D<empty>" and give error.
So question is it possible to evaluate "generator-expressions" within
CMakeLists.txt? Or may be in cmake 3.x there another is way to extract
compilation
flags without such magic as above?
--
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:
http://public.kitware.com/mailman/listinfo/cmake