Переглянути джерело

Fix CTK build when not all plugins/apps/libraries are enabled.

Following commit 95f4262 teaching the build system how to understand
the USE_SYSTEM option, the enabling variables were systematically set
in the ctkBlocCheckDependencies module.

Since the logic deciding if "find_package(PackageName)" should be called
was simply done by just checking if the
"< <PackageName>_enabling_variable>_FIND_PACKAGE_CMD" variable was set
or not, the build was failing when done without all external project
required.

See #418
Jean-Christophe Fillion-Robin 11 роки тому
батько
коміт
6610310719
1 змінених файлів з 7 додано та 3 видалено
  1. 7 3
      CMakeLists.txt

+ 7 - 3
CMakeLists.txt

@@ -953,9 +953,13 @@ endif()
 # Expand variables containing include and library directories for external projects
 # This relies on the variable EXTERNAL_TARGETS set in ctkMacroValidateBuildOptions
 foreach(_external_target ${EXTERNAL_TARGETS})
-  if(${_external_target}_FIND_PACKAGE_CMD)
-    #message("Calling find_package(${${_external_target}_FIND_PACKAGE_CMD})")
-    find_package(${${_external_target}_FIND_PACKAGE_CMD} REQUIRED)
+  set(_package_name ${${_external_target}_FIND_PACKAGE_CMD})
+  if(_package_name)
+    superbuild_is_external_project_includable(${_package_name} required)
+    if(required)
+      #message("Calling find_package(${_package_name})")
+      find_package(${_package_name} REQUIRED)
+    endif()
   endif()
 endforeach()