diff options
Diffstat (limited to 'Tests/CompileOptions')
-rw-r--r-- | Tests/CompileOptions/CMakeLists.txt | 20 | ||||
-rw-r--r-- | Tests/CompileOptions/main.cpp | 20 | ||||
-rw-r--r-- | Tests/CompileOptions/other.cpp | 5 |
3 files changed, 45 insertions, 0 deletions
diff --git a/Tests/CompileOptions/CMakeLists.txt b/Tests/CompileOptions/CMakeLists.txt new file mode 100644 index 0000000..52c3759 --- /dev/null +++ b/Tests/CompileOptions/CMakeLists.txt @@ -0,0 +1,20 @@ +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 + "-DTEST_DEFINE" + "-DNEEDS_ESCAPE=\"E$CAPE\"" + "$<$<CXX_COMPILER_ID:GNU>:-DTEST_DEFINE_GNU>" + ) +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..90740f1 --- /dev/null +++ b/Tests/CompileOptions/main.cpp @@ -0,0 +1,20 @@ +#ifndef TEST_DEFINE +# error Expected definition TEST_DEFINE +#endif + +#ifndef NEEDS_ESCAPE +# error Expected definition NEEDS_ESCAPE +#endif + +#ifdef DO_GNU_TESTS +# ifndef TEST_DEFINE_GNU +# error Expected definition TEST_DEFINE_GNU +# endif +#endif + +#include <string.h> + +int main() +{ + return strcmp(NEEDS_ESCAPE, "E$CAPE") == 0 ? 0 : 1; +} 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) +{ + +} |