Shell Test: Simplify CMake code
@@ -6,6 +6,16 @@ if (SHARED_ONLY_PLUGINS)
list (REMOVE_ITEM ADDED_PLUGINS_WITHOUT_ONLY_SHARED ${SHARED_ONLY_PLUGINS})
endif (SHARED_ONLY_PLUGINS)
+if (BUILD_FULL)
+ set (KDB_COMMAND_BASENAME kdb-full)
+elseif (BUILD_STATIC)
+ set (KDB_COMMAND_BASENAME kdb-static)
+elseif (BUILD_SHARED)
+ set (KDB_COMMAND_BASENAME kdb)
+elseif (ENABLE_KDB_TESTING)
+ message (SEND_ERROR "no kdb tool found, please enable BUILD_FULL, BUILD_STATIC or BUILD_SHARED")
+endif (BUILD_FULL)
+
set (IS_INSTALLED "YES")
configure_file ("${CMAKE_CURRENT_SOURCE_DIR}/include_common.sh.in" "${CMAKE_CURRENT_BINARY_DIR}/include_common.sh" @ONLY)
@@ -49,15 +59,7 @@ function (add_scripttest testname)
list (FIND excluded_tests "${testname_we}" index_excluded)
if (index_excluded EQUAL -1)
- if (BUILD_FULL)
- set (KDB_COMMAND "kdb-full")
- else (BUILD_FULL)
- if (BUILD_STATIC)
- set (KDB_COMMAND "kdb-static")
- else (BUILD_STATIC)
- set (KDB_COMMAND "kdb")
- endif (BUILD_STATIC)
- endif (BUILD_FULL)
+ set (KDB_COMMAND ${KDB_COMMAND_BASENAME})
set (RACE_COMMAND "$KDB race")
set (INCLUDE_COMMON
"${INCLUDE_COMMON_INSTALLED_FILE}if [ -z \"$KDB\" ]; then KDB=${KDB_COMMAND}; fi")
@@ -78,17 +80,7 @@ function (add_scripttest testname)
else (TARGET)
if (ENABLE_KDB_TESTING)
if (NOT ${testname_we} STREQUAL "run_all")
- if (BUILD_FULL)
- set (KDB_COMMAND "${CMAKE_BINARY_DIR}/bin/kdb-full")
- elseif (BUILD_STATIC)
- set (KDB_COMMAND "${CMAKE_BINARY_DIR}/bin/kdb-static")
- elseif (BUILD_SHARED)
- set (KDB_COMMAND "${CMAKE_BINARY_DIR}/bin/kdb")
- else ()
- message (
- SEND_ERROR
- "no kdb tool found, please enable BUILD_FULL, BUILD_STATIC or BUILD_SHARED")
- endif (BUILD_FULL)
+ set (KDB_COMMAND "${CMAKE_BINARY_DIR}/bin/${KDB_COMMAND_BASENAME}")
set (RACE_COMMAND "${CMAKE_BINARY_DIR}/bin/race")
set (INCLUDE_COMMON "${INCLUDE_COMMON_FILE}KDB=\"${KDB_COMMAND}\"")
set (testscriptname "${CMAKE_CURRENT_BINARY_DIR}/testscr_${testname}")
