mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
OpmFind.cmake: prevent multiple calls to the same module in the same run
this prevents to check for the same module more than once in the same cmake run and should thus speed things up a bit as well as make the output a bit cleaner. For this I assumed that the ${name}_FOUND cmake variable does not get cached, which it seems like it does not...
This commit is contained in:
parent
5601eece73
commit
113162263d
@ -137,16 +137,19 @@ macro (find_and_append_package_to prefix name)
|
|||||||
# using config mode is better than using module (aka. find) mode
|
# using config mode is better than using module (aka. find) mode
|
||||||
# because then the package has already done all its probes and
|
# because then the package has already done all its probes and
|
||||||
# stored them in the config file for us
|
# stored them in the config file for us
|
||||||
if (NOT (${name}_FOUND OR ${NAME}_FOUND))
|
if (NOT DEFINED ${name}_FOUND)
|
||||||
if (${name}_DIR)
|
if (${name}_DIR)
|
||||||
message (STATUS "Finding package ${name} using config mode")
|
message (STATUS "Finding package ${name} using config mode")
|
||||||
find_package (${name} ${ARGN} NO_MODULE PATHS ${${name}_DIR} NO_DEFAULT_PATH)
|
find_package (${name} ${ARGN} NO_MODULE PATHS ${${name}_DIR} NO_DEFAULT_PATH)
|
||||||
else (${name}_DIR)
|
else ()
|
||||||
message (STATUS "Finding package ${name} using module mode")
|
message (STATUS "Finding package ${name} using module mode")
|
||||||
find_package (${name} ${ARGN})
|
find_package (${name} ${ARGN})
|
||||||
endif (${name}_DIR)
|
endif ()
|
||||||
endif (NOT (${name}_FOUND OR ${NAME}_FOUND))
|
endif ()
|
||||||
endif (CMAKE_DISABLE_FIND_PACKAGE_${name})
|
if (NOT ${name}_FOUND)
|
||||||
|
set (${name}_FOUND "0")
|
||||||
|
endif ()
|
||||||
|
endif ()
|
||||||
|
|
||||||
# the variable "NAME" may be replaced during find_package (as this is
|
# the variable "NAME" may be replaced during find_package (as this is
|
||||||
# now a macro, and not a function anymore), so we must reinitialize
|
# now a macro, and not a function anymore), so we must reinitialize
|
||||||
|
Loading…
Reference in New Issue
Block a user