Only compile code if non-empty code was submitted for DUNE/OPM.
Also make the search fail if the compilation fails.
This commit is contained in:
parent
d5388ba653
commit
7c30586fde
@ -115,26 +115,34 @@ macro (find_opm_package module deps header lib defs prog conf)
|
|||||||
# without config.h
|
# without config.h
|
||||||
config_cmd_line (${module}_CMD_CONFIG ${module}_CONFIG_VARS)
|
config_cmd_line (${module}_CMD_CONFIG ${module}_CONFIG_VARS)
|
||||||
|
|
||||||
# check that we can compile a small test-program
|
if(prog)
|
||||||
include (CMakePushCheckState)
|
# check that we can compile a small test-program
|
||||||
cmake_push_check_state ()
|
include (CMakePushCheckState)
|
||||||
include (CheckCXXSourceCompiles)
|
cmake_push_check_state ()
|
||||||
# only add these if they are actually found; otherwise it won't
|
include (CheckCXXSourceCompiles)
|
||||||
# compile and the variable won't be set
|
# only add these if they are actually found; otherwise it won't
|
||||||
append_found (${module}_INCLUDE_DIRS CMAKE_REQUIRED_INCLUDES)
|
# compile and the variable won't be set
|
||||||
append_found (${module}_LIBRARIES CMAKE_REQUIRED_LIBRARIES)
|
append_found (${module}_INCLUDE_DIRS CMAKE_REQUIRED_INCLUDES)
|
||||||
# since we don't have any config.h yet
|
append_found (${module}_LIBRARIES CMAKE_REQUIRED_LIBRARIES)
|
||||||
list (APPEND CMAKE_REQUIRED_DEFINITIONS ${${module}_DEFINITIONS})
|
# since we don't have any config.h yet
|
||||||
list (APPEND CMAKE_REQUIRED_DEFINITIONS ${${module}_CMD_CONFIG})
|
list (APPEND CMAKE_REQUIRED_DEFINITIONS ${${module}_DEFINITIONS})
|
||||||
check_cxx_source_compiles ("${prog}" HAVE_${MODULE})
|
list (APPEND CMAKE_REQUIRED_DEFINITIONS ${${module}_CMD_CONFIG})
|
||||||
cmake_pop_check_state ()
|
check_cxx_source_compiles ("${prog}" HAVE_${MODULE})
|
||||||
|
cmake_pop_check_state ()
|
||||||
|
else(prog)
|
||||||
|
if(${module}_FOUND)
|
||||||
|
# No test code provided, mark compilation as successful
|
||||||
|
# if module was founf
|
||||||
|
set(HAVE_${MODULE} 1)
|
||||||
|
endif(${module}_FOUND)
|
||||||
|
endif(prog)
|
||||||
|
|
||||||
# write status message in the same manner as everyone else
|
# write status message in the same manner as everyone else
|
||||||
include (FindPackageHandleStandardArgs)
|
include (FindPackageHandleStandardArgs)
|
||||||
find_package_handle_standard_args (
|
find_package_handle_standard_args (
|
||||||
${module}
|
${module}
|
||||||
DEFAULT_MSG
|
DEFAULT_MSG
|
||||||
${module}_INCLUDE_DIRS ${module}_LIBRARIES ${module}_FOUND ${module}_ALL_PREREQS
|
${module}_INCLUDE_DIRS ${module}_LIBRARIES ${module}_FOUND ${module}_ALL_PREREQS HAVE_${MODULE}
|
||||||
)
|
)
|
||||||
|
|
||||||
# some genius that coded the FindPackageHandleStandardArgs figured out
|
# some genius that coded the FindPackageHandleStandardArgs figured out
|
||||||
|
Loading…
Reference in New Issue
Block a user