Merge pull request #448 from andlaus/prevent_multiple_package_detections
OpmFind.cmake: prevent multiple calls to the same module in the same run
This commit is contained in:
commit
1d1dc493e8
1 file changed
+11
-5
@@ -137,16 +137,22 @@ macro (find_and_append_package_to prefix name)
|
||||
# using config mode is better than using module (aka. find) mode
|
||||
# because then the package has already done all its probes and
|
||||
# stored them in the config file for us
|
||||
if (NOT (${name}_FOUND OR ${NAME}_FOUND))
|
||||
if (NOT DEFINED ${name}_FOUND AND NOT DEFINED ${NAME}_FOUND)
|
||||
if (${name}_DIR)
|
||||
message (STATUS "Finding package ${name} using config mode")
|
||||
find_package (${name} ${ARGN} NO_MODULE PATHS ${${name}_DIR} NO_DEFAULT_PATH)
|
||||
else (${name}_DIR)
|
||||
else ()
|
||||
message (STATUS "Finding package ${name} using module mode")
|
||||
find_package (${name} ${ARGN})
|
||||
endif (${name}_DIR)
|
||||
endif (NOT (${name}_FOUND OR ${NAME}_FOUND))
|
||||
endif (CMAKE_DISABLE_FIND_PACKAGE_${name})
|
||||
endif ()
|
||||
endif ()
|
||||
if (NOT DEFINED ${name}_FOUND)
|
||||
set (${name}_FOUND "${${NAME}_FOUND}")
|
||||
endif ()
|
||||
if (NOT DEFINED ${NAME}_FOUND)
|
||||
set (${NAME}_FOUND "${${name}_FOUND}")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# the variable "NAME" may be replaced during find_package (as this is
|
||||
# now a macro, and not a function anymore), so we must reinitialize
|
||||
|
||||
Reference in new issue
Block a user