summaryrefslogtreecommitdiffstats
path: root/Tests/CMakeLists.txt
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-02-13 16:47:47 (GMT)
committerBrad King <brad.king@kitware.com>2015-02-13 16:50:38 (GMT)
commitd891d47434a181f14554622118c39c954d6a9466 (patch)
tree21c452c4418f586c251c1da441dc2346bb7f9557 /Tests/CMakeLists.txt
parent0304e545289bb32a43a7c8973d604dad860f360b (diff)
downloadCMake-d891d47434a181f14554622118c39c954d6a9466.zip
CMake-d891d47434a181f14554622118c39c954d6a9466.tar.gz
CMake-d891d47434a181f14554622118c39c954d6a9466.tar.bz2
Tests: Consolidate detection of 'rpmbuild'
Several tests use slight variations of the same logic to enable CPack RPM tests. Consolidate this logic into one check before any tests are added. Look for 'rpmbuild' only on Linux and only when the test build tree does not have spaces in the path. In particular, this will make the result available in time for the RunCMake.CPackRPM test to be activated even if CMake is configured exactly once.
Diffstat (limited to 'Tests/CMakeLists.txt')
-rw-r--r--Tests/CMakeLists.txt25
1 files changed, 15 insertions, 10 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 7e7aa2e..cb45e79 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -102,6 +102,17 @@ if(BUILD_TESTING)
list(APPEND build_options -DCMAKE_MAKE_PROGRAM:FILEPATH=${CMake_TEST_EXPLICIT_MAKE_PROGRAM})
endif()
+ # Look for rpmbuild to use for tests.
+ # The tool does not work with spaces in the path.
+ if (CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT CMAKE_CURRENT_BINARY_DIR MATCHES " ")
+ find_program(RPMBUILD_EXECUTABLE NAMES rpmbuild)
+ else()
+ set(RPMBUILD_EXECUTABLE "RPMBUILD_EXECUTABLE-NOTFOUND")
+ endif()
+
+ #---------------------------------------------------------------------------
+ # Add tests below here.
+
if(NOT CMake_TEST_EXTERNAL_CMAKE)
add_subdirectory(CMakeLib)
endif()
@@ -826,11 +837,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
set(CTEST_package_X11_TEST ${CTEST_TEST_CPACK})
set(CTEST_RUN_CPackComponentsForAll ${CTEST_TEST_CPACK})
- if (CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT CMAKE_CURRENT_BINARY_DIR MATCHES " ")
- find_program(RPMBUILD NAMES rpmbuild)
- endif()
# Do not try to build RPM
- if (NOT RPMBUILD)
+ if (NOT RPMBUILD_EXECUTABLE)
set(CPACK_BINARY_RPM OFF)
endif()
@@ -912,7 +920,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
if(CTEST_RUN_CPackComponentsForAll)
# Check whether if rpmbuild command is found
# before adding RPM tests
- find_program(RPMBUILD_EXECUTABLE NAMES rpmbuild)
if(RPMBUILD_EXECUTABLE)
list(APPEND ACTIVE_CPACK_GENERATORS RPM)
endif()
@@ -931,11 +938,9 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
if(APPLE)
list(APPEND GENLST "DragNDrop")
endif()
- if (NOT CMAKE_CURRENT_BINARY_DIR MATCHES " ")
- list(FIND ACTIVE_CPACK_GENERATORS "RPM" RPM_ACTIVE)
- if (NOT ${RPM_ACTIVE} EQUAL -1)
- list(APPEND GENLST "RPM")
- endif()
+ list(FIND ACTIVE_CPACK_GENERATORS "RPM" RPM_ACTIVE)
+ if (NOT ${RPM_ACTIVE} EQUAL -1)
+ list(APPEND GENLST "RPM")
endif()
list(FIND ACTIVE_CPACK_GENERATORS "DEB" DEB_ACTIVE)
if (NOT ${DEB_ACTIVE} EQUAL -1)