From 848f2201c59c3d19243ed093db6e9ffbfd7b4698 Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Thu, 28 Jun 2012 13:49:49 +0200 Subject: Do not run cpack at CMake time it is not available. cpack was used to get the list of available i.e. ACTIVE CPack generators in the CMake tests suite. This was done in order to get dynamically available CPack generators like DEB or RPM that may or may not be available on some platform like MacOSX depending on the fact that some command are installed or not. We may do that but not during initial configuration. The current patch fixes the problem and we may do better in the future like configuring CPack tests later. --- Tests/CMakeLists.txt | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 9deb8ac..e631194 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -717,31 +717,21 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ ENDIF(CTEST_RUN_CPackComponents) IF(CTEST_RUN_CPackComponentsForAll) - # Analyze 'cpack --help' output for list of available generators: - execute_process(COMMAND ${CMAKE_CPACK_COMMAND} --help - RESULT_VARIABLE result - OUTPUT_VARIABLE stdout - ERROR_VARIABLE stderr) - - string(REPLACE ";" "\\;" stdout "${stdout}") - string(REPLACE "\n" "E;" stdout "${stdout}") - - set(collecting 0) - set(ACTIVE_CPACK_GENERATORS) - foreach(eline ${stdout}) - string(REGEX REPLACE "^(.*)E$" "\\1" line "${eline}") - if(collecting AND NOT line STREQUAL "") - string(REGEX REPLACE "^ ([^ ]+) += (.*)$" "\\1" gen "${line}") - string(REGEX REPLACE "^ ([^ ]+) += (.*)$" "\\2" doc "${line}") - list(APPEND ACTIVE_CPACK_GENERATORS ${gen}) - endif() - if(line STREQUAL "Generators") - set(collecting 1) - endif() - endforeach() + # 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(RPMBUILD_EXECUTABLE) + # Check whether if dpkg command is found + # before adding DEB tests + find_program(DPKG_EXECUTABLE NAMES dpkg) + if(DPKG_EXECUTABLE) + list(APPEND ACTIVE_CPACK_GENERATORS DEB) + endif(DPKG_EXECUTABLE) + # ACTIVE_CPACK_GENERATORS variable # now contains the list of 'active generators' - set(CPackComponentsForAll_EXTRA_OPTIONS) set(CPackRun_CPackCommand "-DCPackCommand=${CMAKE_CPACK_COMMAND}") # set up list of CPack generators -- cgit v0.12 From a8c659cd6e39b14efb015e2bbee14b146a9f3be5 Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Mon, 2 Jul 2012 19:49:07 +0200 Subject: Find dpkg and rpmbuild in usual Fink and MacPort paths --- Source/CPack/cmCPackDebGenerator.h | 5 ++++- Source/CPack/cmCPackRPMGenerator.h | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Source/CPack/cmCPackDebGenerator.h b/Source/CPack/cmCPackDebGenerator.h index 7f2352f..84b0023 100644 --- a/Source/CPack/cmCPackDebGenerator.h +++ b/Source/CPack/cmCPackDebGenerator.h @@ -35,7 +35,10 @@ public: { #ifdef __APPLE__ // on MacOS enable CPackDeb iff dpkg is found - return cmSystemTools::FindProgram("dpkg") != "" ? true : false; + std::vector locations; + locations.push_back("/sw"); // Fink + locations.push_back("/opt/local"); //MacPort + return cmSystemTools::FindProgram("dpkg",locations) != "" ? true : false; #else // legacy behavior on other systems return true; diff --git a/Source/CPack/cmCPackRPMGenerator.h b/Source/CPack/cmCPackRPMGenerator.h index eec8204..c7dace4 100644 --- a/Source/CPack/cmCPackRPMGenerator.h +++ b/Source/CPack/cmCPackRPMGenerator.h @@ -39,6 +39,9 @@ public: { #ifdef __APPLE__ // on MacOS enable CPackRPM iff rpmbuild is found + std::vector locations; + locations.push_back("/sw"); // Fink + locations.push_back("/opt/local"); //MacPort return cmSystemTools::FindProgram("rpmbuild") != "" ? true : false; #else // legacy behavior on other systems -- cgit v0.12 From b47cffa9b892b3f4bd3d99efb4e3130440af8300 Mon Sep 17 00:00:00 2001 From: David Cole Date: Fri, 20 Jul 2012 11:43:41 -0400 Subject: CPack: Use bin subdir when looking for dpkg and rpmbuild --- Source/CPack/cmCPackDebGenerator.h | 4 ++-- Source/CPack/cmCPackRPMGenerator.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/CPack/cmCPackDebGenerator.h b/Source/CPack/cmCPackDebGenerator.h index 84b0023..d678cfa 100644 --- a/Source/CPack/cmCPackDebGenerator.h +++ b/Source/CPack/cmCPackDebGenerator.h @@ -36,8 +36,8 @@ public: #ifdef __APPLE__ // on MacOS enable CPackDeb iff dpkg is found std::vector locations; - locations.push_back("/sw"); // Fink - locations.push_back("/opt/local"); //MacPort + locations.push_back("/sw/bin"); // Fink + locations.push_back("/opt/local/bin"); // MacPorts return cmSystemTools::FindProgram("dpkg",locations) != "" ? true : false; #else // legacy behavior on other systems diff --git a/Source/CPack/cmCPackRPMGenerator.h b/Source/CPack/cmCPackRPMGenerator.h index c7dace4..a7722bc 100644 --- a/Source/CPack/cmCPackRPMGenerator.h +++ b/Source/CPack/cmCPackRPMGenerator.h @@ -40,8 +40,8 @@ public: #ifdef __APPLE__ // on MacOS enable CPackRPM iff rpmbuild is found std::vector locations; - locations.push_back("/sw"); // Fink - locations.push_back("/opt/local"); //MacPort + locations.push_back("/sw/bin"); // Fink + locations.push_back("/opt/local/bin"); // MacPorts return cmSystemTools::FindProgram("rpmbuild") != "" ? true : false; #else // legacy behavior on other systems -- cgit v0.12