diff options
author | Stephen Kelly <steveire@gmail.com> | 2013-05-16 13:15:28 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2013-06-02 09:56:37 (GMT) |
commit | 80ca9c4b41ecdce069a6c3f4c1b558084a748876 (patch) | |
tree | e96eb29cd532378cd79c3e3ea4bb975ffbc2e285 /Tests | |
parent | 7cb23084b2595d06aea46cead0e077b5f13aeddb (diff) | |
download | CMake-80ca9c4b41ecdce069a6c3f4c1b558084a748876.zip CMake-80ca9c4b41ecdce069a6c3f4c1b558084a748876.tar.gz CMake-80ca9c4b41ecdce069a6c3f4c1b558084a748876.tar.bz2 |
Add COMPILE_OPTIONS target property.
This method reads generator expressions from the COMPILE_OPTIONS
target property, as well as INTERFACE_COMPILE_OPTIONS from linked
dependents.
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Tests/CompileOptions/CMakeLists.txt | 16 | ||||
-rw-r--r-- | Tests/CompileOptions/main.cpp | 11 | ||||
-rw-r--r-- | Tests/CompileOptions/other.cpp | 5 |
4 files changed, 33 insertions, 0 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 0b221e8..3a28be2 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -245,6 +245,7 @@ if(BUILD_TESTING) ADD_TEST_MACRO(PolicyScope PolicyScope) ADD_TEST_MACRO(EmptyLibrary EmptyLibrary) ADD_TEST_MACRO(CompileDefinitions CompileDefinitions) + ADD_TEST_MACRO(CompileOptions CompileOptions) ADD_TEST_MACRO(CompatibleInterface CompatibleInterface) set_tests_properties(EmptyLibrary PROPERTIES PASS_REGULAR_EXPRESSION "CMake Error: CMake can not determine linker language for target:test") diff --git a/Tests/CompileOptions/CMakeLists.txt b/Tests/CompileOptions/CMakeLists.txt new file mode 100644 index 0000000..6d8a96a --- /dev/null +++ b/Tests/CompileOptions/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 2.8) + +project(CompileOptions) + +add_library(testlib other.cpp) + +add_executable(CompileOptions main.cpp) +set_property(TARGET CompileOptions PROPERTY COMPILE_OPTIONS "$<$<CXX_COMPILER_ID:GNU>:-DTEST_DEFINE>") +target_link_libraries(CompileOptions testlib) + +if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") + target_compile_definitions(CompileOptions + PRIVATE + "DO_GNU_TESTS" + ) +endif() diff --git a/Tests/CompileOptions/main.cpp b/Tests/CompileOptions/main.cpp new file mode 100644 index 0000000..0d39050 --- /dev/null +++ b/Tests/CompileOptions/main.cpp @@ -0,0 +1,11 @@ + +#ifdef DO_GNU_TESTS +# ifndef TEST_DEFINE +# error Expected TEST_DEFINE +# endif +#endif + +int main(int argc, char **argv) +{ + return 0; +} diff --git a/Tests/CompileOptions/other.cpp b/Tests/CompileOptions/other.cpp new file mode 100644 index 0000000..0e34375 --- /dev/null +++ b/Tests/CompileOptions/other.cpp @@ -0,0 +1,5 @@ + +void foo(void) +{ + +} |