summaryrefslogtreecommitdiff
path: root/Tests/CMakeOnly
diff options
context:
space:
mode:
authorRolf Eike Beer <eike@sf-mail.de>2012-10-21 15:17:20 +0200
committerRolf Eike Beer <eike@sf-mail.de>2012-10-21 15:17:20 +0200
commit5052fbc93d8158e44d1a44f167ba00f39813b82f (patch)
tree741496a3bc8ea87822fa1a3ac61fe0159336c867 /Tests/CMakeOnly
parent4c5db6ce6c2bb90f0f7eaa54f31e35767d9e5816 (diff)
downloadcmake-5052fbc93d8158e44d1a44f167ba00f39813b82f.tar.gz
SelectLibraryConfigurations: add testcase
Diffstat (limited to 'Tests/CMakeOnly')
-rw-r--r--Tests/CMakeOnly/CMakeLists.txt2
-rw-r--r--Tests/CMakeOnly/SelectLibraryConfigurations/CMakeLists.txt60
2 files changed, 62 insertions, 0 deletions
diff --git a/Tests/CMakeOnly/CMakeLists.txt b/Tests/CMakeOnly/CMakeLists.txt
index ba681d8acb..51a630fe58 100644
--- a/Tests/CMakeOnly/CMakeLists.txt
+++ b/Tests/CMakeOnly/CMakeLists.txt
@@ -27,6 +27,8 @@ endif()
add_CMakeOnly_test(AllFindModules)
+add_CMakeOnly_test(SelectLibraryConfigurations)
+
add_CMakeOnly_test(TargetScope)
add_CMakeOnly_test(find_library)
diff --git a/Tests/CMakeOnly/SelectLibraryConfigurations/CMakeLists.txt b/Tests/CMakeOnly/SelectLibraryConfigurations/CMakeLists.txt
new file mode 100644
index 0000000000..b3b05c34e8
--- /dev/null
+++ b/Tests/CMakeOnly/SelectLibraryConfigurations/CMakeLists.txt
@@ -0,0 +1,60 @@
+cmake_minimum_required(VERSION 2.8)
+
+project(SelectLibraryConfigurations NONE)
+
+include(${CMAKE_ROOT}/Modules/SelectLibraryConfigurations.cmake)
+
+macro(check_slc basename expect)
+ message(STATUS "checking select_library_configurations(${basename})")
+ select_library_configurations(${basename})
+ if (NOT ${basename}_LIBRARY STREQUAL "${expect}")
+ message(SEND_ERROR "select_library_configurations(${basename}) returned '${${basename}_LIBRARY}' but '${expect}' was expected")
+ endif ()
+ if (NOT ${basename}_LIBRARY STREQUAL "${${basename}_LIBRARIES}")
+ message(SEND_ERROR "select_library_configurations(${basename}) LIBRARY: '${${basename}_LIBRARY}' LIBRARIES: '${${basename}_LIBRARIES}'")
+ endif ()
+endmacro(check_slc)
+
+if (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
+ set(NOTYPE_RELONLY_LIBRARY_RELEASE "opt")
+ check_slc(NOTYPE_RELONLY "opt")
+
+ set(NOTYPE_DBGONLY_LIBRARY_DEBUG "dbg")
+ check_slc(NOTYPE_DBGONLY "dbg")
+
+ set(NOTYPE_RELDBG_LIBRARY_RELEASE "opt")
+ set(NOTYPE_RELDBG_LIBRARY_DEBUG "dbg")
+ check_slc(NOTYPE_RELDBG "opt")
+
+ set(CMAKE_BUILD_TYPE Debug)
+endif ()
+
+check_slc(empty "")
+
+set(OPTONLY_LIBRARY_RELEASE "opt")
+check_slc(OPTONLY "opt")
+
+set(DBGONLY_LIBRARY_RELEASE "dbg")
+check_slc(DBGONLY "dbg")
+
+set(OPTONLYLIST_LIBRARY_RELEASE "opt1;opt2")
+check_slc(OPTONLYLIST "opt1;opt2")
+
+set(DBGONLYLIST_LIBRARY_RELEASE "dbg1;dbg2")
+check_slc(DBGONLYLIST "dbg1;dbg2")
+
+set(OPT1DBG1_LIBRARY_RELEASE "opt")
+set(OPT1DBG1_LIBRARY_DEBUG "dbg")
+check_slc(OPT1DBG1 "optimized;opt;debug;dbg")
+
+set(OPT1DBG2_LIBRARY_RELEASE "opt")
+set(OPT1DBG2_LIBRARY_DEBUG "dbg1;dbg2")
+check_slc(OPT1DBG2 "optimized;opt;debug;dbg1;debug;dbg2")
+
+set(OPT2DBG1_LIBRARY_RELEASE "opt1;opt2")
+set(OPT2DBG1_LIBRARY_DEBUG "dbg")
+check_slc(OPT2DBG1 "optimized;opt1;optimized;opt2;debug;dbg")
+
+set(OPT2DBG2_LIBRARY_RELEASE "opt1;opt2")
+set(OPT2DBG2_LIBRARY_DEBUG "dbg1;dbg2")
+check_slc(OPT2DBG2 "optimized;opt1;optimized;opt2;debug;dbg1;debug;dbg2")