summaryrefslogtreecommitdiffstats
path: root/Tests/CMakeCommands/target_compile_options/CMakeLists.txt
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2014-11-25 21:47:44 (GMT)
committerStephen Kelly <steveire@gmail.com>2015-03-09 19:48:57 (GMT)
commit5c559f11137dcb14113a3c5df99ff896c65c7596 (patch)
tree63e0fcb01e959715cd0eca161ec799f5e1048fb2 /Tests/CMakeCommands/target_compile_options/CMakeLists.txt
parente387ce7d681f9bd6c90c41f34b7500dfeb3b32ba (diff)
downloadCMake-5c559f11137dcb14113a3c5df99ff896c65c7596.zip
CMake-5c559f11137dcb14113a3c5df99ff896c65c7596.tar.gz
CMake-5c559f11137dcb14113a3c5df99ff896c65c7596.tar.bz2
Genex: Enable use of COMPILE_LANGUAGE for compile options.
Follow-ups will allow the use of the generator expression for compile definitions and include directories for non-IDE generators.
Diffstat (limited to 'Tests/CMakeCommands/target_compile_options/CMakeLists.txt')
-rw-r--r--Tests/CMakeCommands/target_compile_options/CMakeLists.txt15
1 files changed, 15 insertions, 0 deletions
diff --git a/Tests/CMakeCommands/target_compile_options/CMakeLists.txt b/Tests/CMakeCommands/target_compile_options/CMakeLists.txt
index 1d04639..35dd276 100644
--- a/Tests/CMakeCommands/target_compile_options/CMakeLists.txt
+++ b/Tests/CMakeCommands/target_compile_options/CMakeLists.txt
@@ -23,6 +23,21 @@ add_executable(consumer
"${CMAKE_CURRENT_SOURCE_DIR}/consumer.cpp"
)
+if (NOT CMAKE_GENERATOR MATCHES "Visual Studio")
+ target_sources(consumer PRIVATE
+ "${CMAKE_CURRENT_SOURCE_DIR}/consumer.c"
+ )
+ target_compile_options(consumer
+ PRIVATE
+ -DCONSUMER_LANG_$<COMPILE_LANGUAGE>
+ -DLANG_IS_CXX=$<COMPILE_LANGUAGE:CXX>
+ -DLANG_IS_C=$<COMPILE_LANGUAGE:C>
+ )
+ target_compile_definitions(consumer
+ PRIVATE -DTEST_LANG_DEFINES
+ )
+endif()
+
target_compile_options(consumer
PRIVATE $<$<CXX_COMPILER_ID:GNU>:$<TARGET_PROPERTY:target_compile_options,INTERFACE_COMPILE_OPTIONS>>
)