Explorar o código

Merge topic 'DoNotInvokeCPackAtCMakeTime-forCMakeTests'

b47cffa CPack: Use bin subdir when looking for dpkg and rpmbuild
a8c659c Find dpkg and rpmbuild in usual Fink and MacPort paths
848f220 Do not run cpack at CMake time it is not available.
David Cole %!s(int64=13) %!d(string=hai) anos
pai
achega
c1bbdbff57
Modificáronse 3 ficheiros con 20 adicións e 24 borrados
  1. 4 1
      Source/CPack/cmCPackDebGenerator.h
  2. 3 0
      Source/CPack/cmCPackRPMGenerator.h
  3. 13 23
      Tests/CMakeLists.txt

+ 4 - 1
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<std::string> locations;
+    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
     return true;

+ 3 - 0
Source/CPack/cmCPackRPMGenerator.h

@@ -39,6 +39,9 @@ public:
     {
 #ifdef __APPLE__
     // on MacOS enable CPackRPM iff rpmbuild is found
+    std::vector<std::string> locations;
+    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

+ 13 - 23
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