diff options
author | Marc Chevrier <marc.chevrier@sap.com> | 2018-04-19 12:58:49 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-04-20 13:28:13 (GMT) |
commit | cb83314e659ccb6396b897d8c7301f758b415fc1 (patch) | |
tree | d739605b4d2f44844f20b2a47d4beaae1abe2e1a /Tests/CMakeCommands | |
parent | 38d854dccff6ddeb69c217252dd9ed9f87fe1b19 (diff) | |
download | CMake-cb83314e659ccb6396b897d8c7301f758b415fc1.zip CMake-cb83314e659ccb6396b897d8c7301f758b415fc1.tar.gz CMake-cb83314e659ccb6396b897d8c7301f758b415fc1.tar.bz2 |
add_compile_definitions: add new command
This command manages preprocessor definitions at directory level and
supports generator expressions.
Fixes: #15374
Diffstat (limited to 'Tests/CMakeCommands')
-rw-r--r-- | Tests/CMakeCommands/add_compile_definitions/CMakeLists.txt | 15 | ||||
-rw-r--r-- | Tests/CMakeCommands/add_compile_definitions/main.cpp | 17 |
2 files changed, 32 insertions, 0 deletions
diff --git a/Tests/CMakeCommands/add_compile_definitions/CMakeLists.txt b/Tests/CMakeCommands/add_compile_definitions/CMakeLists.txt new file mode 100644 index 0000000..2eb887e --- /dev/null +++ b/Tests/CMakeCommands/add_compile_definitions/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.1) + +project(add_compile_definitions LANGUAGES CXX) + +add_compile_definitions(TEST_DEFINITION + $<$<COMPILE_LANGUAGE:CXX>:LANG_$<COMPILE_LANGUAGE>> + $<$<EQUAL:0,1>:UNEXPECTED_DEFINITION>) + +add_executable(add_compile_definitions main.cpp) + +add_library(imp UNKNOWN IMPORTED) +get_target_property(_res imp COMPILE_DEFINITIONS) +if (_res) + message(SEND_ERROR "add_compile_definitions populated the COMPILE_DEFINITIONS target property") +endif() diff --git a/Tests/CMakeCommands/add_compile_definitions/main.cpp b/Tests/CMakeCommands/add_compile_definitions/main.cpp new file mode 100644 index 0000000..b382922 --- /dev/null +++ b/Tests/CMakeCommands/add_compile_definitions/main.cpp @@ -0,0 +1,17 @@ + +#ifndef TEST_DEFINITION +#error Expected TEST_DEFINITION +#endif + +#ifndef LANG_CXX +#error Expected LANG_CXX +#endif + +#ifdef UNPEXTED_DEFINITION +#error Unexpected UNPEXTED_DEFINITION +#endif + +int main(void) +{ + return 0; +} |