Browse Source

COMP: Superbuild - Make sure ${CTK_BINARY_DIR}/CTK-build/bin exists before CTK inner project is built

Indeed some external project may install their libraries directly in
CTK-Superbuild/CTK-build/bin.
Jean-Christophe Fillion-Robin 15 years ago
parent
commit
7f10e86e94
2 changed files with 14 additions and 8 deletions
  1. 7 8
      CMakeLists.txt
  2. 7 0
      SuperBuild.cmake

+ 7 - 8
CMakeLists.txt

@@ -65,21 +65,20 @@ MARK_AS_ADVANCED(CTK_SUPERBUILD)
 # Output directories.
 #
 FOREACH(type LIBRARY RUNTIME ARCHIVE)
-  IF(DEFINED CTK_CMAKE_${type}_OUTPUT_DIRECTORY)
-    # Make sure the directory exists
-    IF(NOT EXISTS ${CTK_CMAKE_${type}_OUTPUT_DIRECTORY})
-      MESSAGE(FATAL_ERROR "CTK_CMAKE_${type}_OUTPUT_DIRECTORY is set to a non-existing directory [${CTK_CMAKE_${type}_OUTPUT_DIRECTORY}]")
-    ENDIF()
+  # Make sure the directory exists
+  IF(DEFINED CTK_CMAKE_${type}_OUTPUT_DIRECTORY
+     AND NOT EXISTS ${CTK_CMAKE_${type}_OUTPUT_DIRECTORY})
+    MESSAGE(FATAL_ERROR "CTK_CMAKE_${type}_OUTPUT_DIRECTORY is set to a non-existing directory [${CTK_CMAKE_${type}_OUTPUT_DIRECTORY}]")
   ENDIF()
   
   IF(CTK_SUPERBUILD)
-    SET(output_dir ${${PROJECT_NAME}_BINARY_DIR}/bin)
+    SET(output_dir ${CTK_BINARY_DIR}/bin)
     IF(NOT DEFINED CTK_CMAKE_${type}_OUTPUT_DIRECTORY)
-      SET(CTK_CMAKE_${type}_OUTPUT_DIRECTORY ${${PROJECT_NAME}_BINARY_DIR}/CTK-build/bin)
+      SET(CTK_CMAKE_${type}_OUTPUT_DIRECTORY ${CTK_BINARY_DIR}/CTK-build/bin)
     ENDIF()
   ELSE()
     IF(NOT DEFINED CTK_CMAKE_${type}_OUTPUT_DIRECTORY)
-      SET(output_dir ${${PROJECT_NAME}_BINARY_DIR}/bin)
+      SET(output_dir ${CTK_BINARY_DIR}/bin)
     ELSE()
       SET(output_dir ${CTK_CMAKE_${type}_OUTPUT_DIRECTORY})
     ENDIF()

+ 7 - 0
SuperBuild.cmake

@@ -34,6 +34,13 @@ CMAKE_MINIMUM_REQUIRED(VERSION ${cmake_version_required})
 #
 
 #-----------------------------------------------------------------------------
+# Make sure ${CTK_BINARY_DIR}/CTK-build/bin exists
+# May be used by some external project to install libs (e.g QtMobility)
+IF(NOT EXISTS ${CTK_BINARY_DIR}/CTK-build/bin)
+  FILE(MAKE_DIRECTORY ${CTK_BINARY_DIR}/CTK-build/bin)
+ENDIF()
+
+#-----------------------------------------------------------------------------
 # Enable and setup External project global properties
 #
 INCLUDE(ExternalProject)