diff options
author | Brad King <brad.king@kitware.com> | 2010-06-07 18:36:28 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2010-06-07 18:36:28 (GMT) |
commit | 6cf1ccd63270ab1a8ee790ff8faad17154870b5c (patch) | |
tree | 5456e64a7c6b366480a45f02fa009ec2cef5d454 /Tests | |
parent | 608406bf55ad6aa33acff382c15038e95314a587 (diff) | |
parent | c8b13ecc380e38eda475974bc7ab515a65fe90cc (diff) | |
download | CMake-6cf1ccd63270ab1a8ee790ff8faad17154870b5c.zip CMake-6cf1ccd63270ab1a8ee790ff8faad17154870b5c.tar.gz CMake-6cf1ccd63270ab1a8ee790ff8faad17154870b5c.tar.bz2 |
Merge branch 'per-config-link-flags'
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/CMakeLists.txt | 28 | ||||
-rw-r--r-- | Tests/LinkFlags/CMakeLists.txt | 28 | ||||
-rw-r--r-- | Tests/LinkFlags/LinkFlags.c | 1 | ||||
-rw-r--r-- | Tests/LinkFlags/LinkFlagsExe.c | 6 | ||||
-rw-r--r-- | Tests/LinkFlags/LinkFlagsLib.c | 6 |
5 files changed, 69 insertions, 0 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index b99b183..1b8f4f3 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -174,6 +174,34 @@ IF(BUILD_TESTING) ADD_TEST_MACRO(Module.CheckTypeSize CheckTypeSize) + ADD_TEST(LinkFlags-prepare + ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/LinkFlags" + "${CMake_BINARY_DIR}/Tests/LinkFlags" + --build-generator ${CMAKE_TEST_GENERATOR} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + --build-project LinkFlags + --build-target LinkFlags + --build-options -DTEST_CONFIG=\${CTEST_CONFIGURATION_TYPE} + ) + LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/LinkFlags") + + MACRO(ADD_LINK_FLAGS_TEST name depends) + ADD_TEST(LinkFlags-${name} + ${CMAKE_CMAKE_COMMAND} --build "${CMake_BINARY_DIR}/Tests/LinkFlags" + --target LinkFlags_${name} --config \${CTEST_CONFIGURATION_TYPE} + ) + SET_TESTS_PROPERTIES(LinkFlags-${name} PROPERTIES + PASS_REGULAR_EXPRESSION "BADFLAG" DEPENDS LinkFlags-${depends}) + ENDMACRO() + ADD_LINK_FLAGS_TEST(lib prepare) + ADD_LINK_FLAGS_TEST(dll lib) + ADD_LINK_FLAGS_TEST(exe dll) + ADD_LINK_FLAGS_TEST(lib_config exe) + ADD_LINK_FLAGS_TEST(dll_config lib_config) + ADD_LINK_FLAGS_TEST(exe_config dll_config) + # If we are running right now with a UnixMakefiles based generator, # build the "Simple" test with the ExtraGenerators, if available # This doesn't test whether the generated project files work (unfortunately), diff --git a/Tests/LinkFlags/CMakeLists.txt b/Tests/LinkFlags/CMakeLists.txt new file mode 100644 index 0000000..e06020c --- /dev/null +++ b/Tests/LinkFlags/CMakeLists.txt @@ -0,0 +1,28 @@ +cmake_minimum_required(VERSION 2.8) +project(LinkFlags C) + +string(TOUPPER "${TEST_CONFIG}" TEST_CONFIG_UPPER) +set(obj "${CMAKE_C_OUTPUT_EXTENSION}") +if(BORLAND) + set(pre -) +endif() + +add_library(LinkFlags_lib STATIC LinkFlagsLib.c) +set_property(TARGET LinkFlags_lib PROPERTY STATIC_LIBRARY_FLAGS ${pre}BADFLAG${obj}) + +add_library(LinkFlags_dll SHARED LinkFlagsLib.c) +set_property(TARGET LinkFlags_dll PROPERTY LINK_FLAGS ${pre}BADFLAG${obj}) + +add_executable(LinkFlags_exe LinkFlagsExe.c) +set_property(TARGET LinkFlags_exe PROPERTY LINK_FLAGS ${pre}BADFLAG${obj}) + +add_library(LinkFlags_lib_config STATIC LinkFlagsLib.c) +set_property(TARGET LinkFlags_lib_config PROPERTY STATIC_LIBRARY_FLAGS_${TEST_CONFIG_UPPER} ${pre}BADFLAG_${TEST_CONFIG}${obj}) + +add_library(LinkFlags_dll_config SHARED LinkFlagsLib.c) +set_property(TARGET LinkFlags_dll_config PROPERTY LINK_FLAGS_${TEST_CONFIG_UPPER} ${pre}BADFLAG_${TEST_CONFIG}${obj}) + +add_executable(LinkFlags_exe_config LinkFlagsExe.c) +set_property(TARGET LinkFlags_exe_config PROPERTY LINK_FLAGS_${TEST_CONFIG_UPPER} ${pre}BADFLAG_${TEST_CONFIG}${obj}) + +add_executable(LinkFlags LinkFlags.c) diff --git a/Tests/LinkFlags/LinkFlags.c b/Tests/LinkFlags/LinkFlags.c new file mode 100644 index 0000000..78f2de1 --- /dev/null +++ b/Tests/LinkFlags/LinkFlags.c @@ -0,0 +1 @@ +int main(void) { return 0; } diff --git a/Tests/LinkFlags/LinkFlagsExe.c b/Tests/LinkFlags/LinkFlagsExe.c new file mode 100644 index 0000000..123587a --- /dev/null +++ b/Tests/LinkFlags/LinkFlagsExe.c @@ -0,0 +1,6 @@ +int main(void) { return 0; } + +/* Intel compiler does not reject bad flags or objects! */ +#if defined(__INTEL_COMPILER) +# error BADFLAG +#endif diff --git a/Tests/LinkFlags/LinkFlagsLib.c b/Tests/LinkFlags/LinkFlagsLib.c new file mode 100644 index 0000000..9d8d088 --- /dev/null +++ b/Tests/LinkFlags/LinkFlagsLib.c @@ -0,0 +1,6 @@ +int flags_lib(void) { return 0; } + +/* Intel compiler does not reject bad flags or objects! */ +#if defined(__INTEL_COMPILER) +# error BADFLAG +#endif |