diff options
Diffstat (limited to 'Tests/SetLang')
-rw-r--r-- | Tests/SetLang/CMakeLists.txt | 8 | ||||
-rw-r--r-- | Tests/SetLang/bar.c | 14 | ||||
-rw-r--r-- | Tests/SetLang/zoom.zzz | 7 |
3 files changed, 28 insertions, 1 deletions
diff --git a/Tests/SetLang/CMakeLists.txt b/Tests/SetLang/CMakeLists.txt index 9de4fc6..3eb9185 100644 --- a/Tests/SetLang/CMakeLists.txt +++ b/Tests/SetLang/CMakeLists.txt @@ -15,3 +15,11 @@ if(CMAKE_GENERATOR MATCHES "^Visual Studio" AND "x${CMAKE_C_COMPILER_ID}" STREQU add_library(stay stay_c.c stay_cxx.cxx) set_property(TARGET stay PROPERTY COMPILE_OPTIONS "-TP") endif() + +if((CMAKE_C_COMPILER_ID MATCHES "(GNU|Clang|MSVC|Borland|Embarcadero|Intel|TI|XL)")) + cmake_policy(SET CMP0119 NEW) + add_library(zoom zoom.zzz) + set_source_files_properties(zoom.zzz PROPERTIES LANGUAGE CXX) + target_link_libraries(SetLang zoom) + target_compile_definitions(SetLang PRIVATE WITH_ZOOM) +endif() diff --git a/Tests/SetLang/bar.c b/Tests/SetLang/bar.c index b934356..515e8c2 100644 --- a/Tests/SetLang/bar.c +++ b/Tests/SetLang/bar.c @@ -1,10 +1,22 @@ #include <stdio.h> int foo(); + +#ifdef WITH_ZOOM +int zoom(); +#endif + class A { public: - A() { this->i = foo(); } + A() + { + this->i = foo(); +#ifdef WITH_ZOOM + i += zoom(); + i -= zoom(); +#endif + } int i; }; diff --git a/Tests/SetLang/zoom.zzz b/Tests/SetLang/zoom.zzz new file mode 100644 index 0000000..a0c8899 --- /dev/null +++ b/Tests/SetLang/zoom.zzz @@ -0,0 +1,7 @@ +int zoom() +{ + int r = 10; + r++; + int ret = r + 10; + return ret; +} |