summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/cmake/LLAddBuildTest.cmake56
-rw-r--r--indra/cmake/LLSharedLibs.cmake7
-rw-r--r--indra/cmake/LLTestCommand.cmake11
-rw-r--r--indra/test/CMakeLists.txt14
4 files changed, 51 insertions, 37 deletions
diff --git a/indra/cmake/LLAddBuildTest.cmake b/indra/cmake/LLAddBuildTest.cmake
index bf4d9b72a9..e0c0ae2246 100644
--- a/indra/cmake/LLAddBuildTest.cmake
+++ b/indra/cmake/LLAddBuildTest.cmake
@@ -141,17 +141,9 @@ INCLUDE(GoogleMock)
IF(LL_TEST_VERBOSE)
MESSAGE(STATUS "LL_ADD_PROJECT_UNIT_TESTS ${name} test_cmd = ${TEST_CMD}")
ENDIF(LL_TEST_VERBOSE)
-
- IF(WINDOWS)
- set(LD_LIBRARY_PATH ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR})
- ELSEIF(DARWIN)
- set(LD_LIBRARY_PATH ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/Resources:/usr/lib)
- ELSE(WINDOWS)
- set(LD_LIBRARY_PATH ${SHARED_LIB_STAGING_DIR}:/usr/lib)
- ENDIF(WINDOWS)
- LL_TEST_COMMAND("${LD_LIBRARY_PATH}" ${TEST_CMD})
- SET(TEST_SCRIPT_CMD ${LL_TEST_COMMAND_value})
+ SET_TEST_PATH(LD_LIBRARY_PATH)
+ LL_TEST_COMMAND(TEST_SCRIPT_CMD "${LD_LIBRARY_PATH}" ${TEST_CMD})
IF(LL_TEST_VERBOSE)
MESSAGE(STATUS "LL_ADD_PROJECT_UNIT_TESTS ${name} test_script = ${TEST_SCRIPT_CMD}")
ENDIF(LL_TEST_VERBOSE)
@@ -233,16 +225,9 @@ FUNCTION(LL_ADD_INTEGRATION_TEST
LIST(INSERT test_command test_exe_pos "${TEST_EXE}")
ENDIF (test_exe_pos LESS 0)
- IF(WINDOWS)
- set(LD_LIBRARY_PATH ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR})
- ELSEIF(DARWIN)
- set(LD_LIBRARY_PATH ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/Resources:/usr/lib)
- ELSE(WINDOWS)
- set(LD_LIBRARY_PATH ${SHARED_LIB_STAGING_DIR}:/usr/lib)
- ENDIF(WINDOWS)
+ SET_TEST_PATH(LD_LIBRARY_PATH)
- LL_TEST_COMMAND("${LD_LIBRARY_PATH}" ${test_command})
- SET(TEST_SCRIPT_CMD ${LL_TEST_COMMAND_value})
+ LL_TEST_COMMAND(TEST_SCRIPT_CMD "${LD_LIBRARY_PATH}" ${test_command})
if(TEST_DEBUG)
message(STATUS "TEST_SCRIPT_CMD: ${TEST_SCRIPT_CMD}")
@@ -258,3 +243,36 @@ FUNCTION(LL_ADD_INTEGRATION_TEST
# ADD_TEST(INTEGRATION_TEST_RUNNER_${testname} ${TEST_SCRIPT_CMD})
ENDFUNCTION(LL_ADD_INTEGRATION_TEST)
+
+MACRO(SET_TEST_LIST LISTVAR)
+ IF(WINDOWS)
+ # We typically build/package only Release variants of third-party
+ # libraries, so append the Release staging dir in case the library being
+ # sought doesn't have a debug variant.
+ set(${LISTVAR} ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR} ${SHARED_LIB_STAGING_DIR}/Release)
+ ELSEIF(DARWIN)
+ # We typically build/package only Release variants of third-party
+ # libraries, so append the Release staging dir in case the library being
+ # sought doesn't have a debug variant.
+ set(${LISTVAR} ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/Resources ${SHARED_LIB_STAGING_DIR}/Release/Resources /usr/lib)
+ ELSE(WINDOWS)
+ # Linux uses a single staging directory anyway.
+ set(${LISTVAR} ${SHARED_LIB_STAGING_DIR} /usr/lib)
+ ENDIF(WINDOWS)
+ENDMACRO(SET_TEST_LIST)
+
+MACRO(SET_TEST_PATH PATHVAR)
+ set_test_list(test_list)
+ IF(WINDOWS)
+ set(sep "\;")
+ ELSE(WINDOWS)
+ set(sep ":")
+ ENDIF(WINDOWS)
+ set(path "")
+ set(optsep "")
+ foreach(dir ${test_list})
+ set(path "${path}${optsep}${dir}")
+ set(optsep "${sep}")
+ endforeach(dir)
+ set(${PATHVAR} "${path}")
+ENDMACRO(SET_TEST_PATH)
diff --git a/indra/cmake/LLSharedLibs.cmake b/indra/cmake/LLSharedLibs.cmake
index 6f602680f4..b32a46b736 100644
--- a/indra/cmake/LLSharedLibs.cmake
+++ b/indra/cmake/LLSharedLibs.cmake
@@ -5,7 +5,7 @@ macro(ll_deploy_sharedlibs_command target_exe)
get_filename_component(OUTPUT_PATH ${TARGET_LOCATION} PATH)
if(DARWIN)
- set(SEARCH_DIRS "${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/Resources")
+ SET_TEST_LIST(SEARCH_DIRS)
get_target_property(IS_BUNDLE ${target_exe} MACOSX_BUNDLE)
if(IS_BUNDLE)
# If its a bundle the exe is not in the target location, this should find it.
@@ -15,9 +15,10 @@ macro(ll_deploy_sharedlibs_command target_exe)
set(OUTPUT_PATH ${OUTPUT_PATH}/../Resources)
endif(IS_BUNDLE)
elseif(WINDOWS)
- set(SEARCH_DIRS "${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}" "$ENV{SystemRoot}/system32")
+ SET_TEST_LIST(SEARCH_DIRS)
+ LIST(APPEND SEARCH_DIRS "$ENV{SystemRoot}/system32")
elseif(LINUX)
- set(SEARCH_DIRS "${SHARED_LIB_STAGING_DIR}")
+ SET_TEST_LIST(SEARCH_DIRS)
set(OUTPUT_PATH ${OUTPUT_PATH}/lib)
endif(DARWIN)
diff --git a/indra/cmake/LLTestCommand.cmake b/indra/cmake/LLTestCommand.cmake
index fae5640493..3002720754 100644
--- a/indra/cmake/LLTestCommand.cmake
+++ b/indra/cmake/LLTestCommand.cmake
@@ -1,13 +1,14 @@
-MACRO(LL_TEST_COMMAND LD_LIBRARY_PATH)
+MACRO(LL_TEST_COMMAND OUTVAR LD_LIBRARY_PATH)
# nat wonders how Kitware can use the term 'function' for a construct that
# cannot return a value. And yet, variables you set inside a FUNCTION are
# local. Try a MACRO instead.
- SET(LL_TEST_COMMAND_value
+ SET(value
${PYTHON_EXECUTABLE}
"${CMAKE_SOURCE_DIR}/cmake/run_build_test.py")
IF(LD_LIBRARY_PATH)
- LIST(APPEND LL_TEST_COMMAND_value "-l${LD_LIBRARY_PATH}")
+ LIST(APPEND value "-l${LD_LIBRARY_PATH}")
ENDIF(LD_LIBRARY_PATH)
- LIST(APPEND LL_TEST_COMMAND_value ${ARGN})
-##MESSAGE(STATUS "Will run: ${LL_TEST_COMMAND_value}")
+ LIST(APPEND value ${ARGN})
+ SET(${OUTVAR} ${value})
+##MESSAGE(STATUS "Will run: ${value}")
ENDMACRO(LL_TEST_COMMAND)
diff --git a/indra/test/CMakeLists.txt b/indra/test/CMakeLists.txt
index c1360987a5..955c77c041 100644
--- a/indra/test/CMakeLists.txt
+++ b/indra/test/CMakeLists.txt
@@ -13,6 +13,7 @@ include(LLXML)
include(LScript)
include(Linking)
include(Tut)
+include(LLAddBuildTest)
include(GoogleMock)
@@ -117,19 +118,12 @@ endif (WINDOWS)
get_target_property(TEST_EXE test LOCATION)
-IF(WINDOWS)
- set(LD_LIBRARY_PATH ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR})
-ELSEIF(DARWIN)
- set(LD_LIBRARY_PATH ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/Resources:/usr/lib)
-ELSE(WINDOWS)
- set(LD_LIBRARY_PATH ${SHARED_LIB_STAGING_DIR}:/usr/lib)
-ENDIF(WINDOWS)
-
-LL_TEST_COMMAND("${LD_LIBRARY_PATH}"
+SET_TEST_PATH(LD_LIBRARY_PATH)
+LL_TEST_COMMAND(command "${LD_LIBRARY_PATH}"
"${TEST_EXE}" "--output=${CMAKE_CURRENT_BINARY_DIR}/cpp_test_results.txt" "--touch=${CMAKE_CURRENT_BINARY_DIR}/cpp_tests_ok.txt")
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/cpp_tests_ok.txt
- COMMAND ${LL_TEST_COMMAND_value}
+ COMMAND ${command}
DEPENDS test
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "C++ unit tests"