mirror of
https://github.com/OPM/opm-upscaling.git
synced 2025-02-25 18:45:23 -06:00
Only regenerate config var file if actually changed
This commit is contained in:
parent
8ee3058af9
commit
6d26126754
@ -118,7 +118,10 @@ opm_sources (${project})
|
||||
# includes the necessary defines by the dependencies
|
||||
include (ConfigVars)
|
||||
list (APPEND ${project}_CONFIG_VARS ${${project}_CONFIG_VAR})
|
||||
set (CONFIG_H "${PROJECT_BINARY_DIR}/config.h")
|
||||
|
||||
# write configuration variables to this file. note that it is a temporary.
|
||||
message (STATUS "Writing config file \"${PROJECT_BINARY_DIR}/config.h\"...")
|
||||
set (CONFIG_H "${PROJECT_BINARY_DIR}/config.h.tmp")
|
||||
configure_vars (
|
||||
FILE CXX ${CONFIG_H}
|
||||
WRITE ${${project}_CONFIG_VARS}
|
||||
@ -130,6 +133,13 @@ define_fc_func (
|
||||
IF HAVE_LAPACK
|
||||
)
|
||||
|
||||
# overwrite the config.h that is used by the code only if we have some
|
||||
# real changes. thus, we don't have to recompile if a reconfigure is run
|
||||
# due to some files being added, for instance
|
||||
execute_process (COMMAND
|
||||
${CMAKE_COMMAND} -E copy_if_different ${CONFIG_H} ${PROJECT_BINARY_DIR}/config.h
|
||||
)
|
||||
|
||||
# compile main library; pull in all required includes and libraries
|
||||
include (OpmCompile)
|
||||
opm_compile (${project})
|
||||
|
@ -27,7 +27,6 @@
|
||||
|
||||
function (configure_vars obj syntax filename verb)
|
||||
# this is just to make the syntax look like the build-in commands
|
||||
message (STATUS "Writing config file \"${filename}\"...")
|
||||
if (NOT ("${obj}" STREQUAL "FILE" AND
|
||||
(("${verb}" STREQUAL "WRITE") OR ("${verb}" STREQUAL "APPEND"))))
|
||||
message (FATAL_ERROR "Syntax error in argument list")
|
||||
@ -47,10 +46,10 @@ function (configure_vars obj syntax filename verb)
|
||||
# to avoid confusion from other configuration files.
|
||||
get_filename_component (_config_path "${filename}" PATH)
|
||||
get_filename_component (_config_file "${filename}" NAME)
|
||||
if ("${_config_file}" STREQUAL "config.h")
|
||||
if ("${_config_file}" MATCHES "config\\.h(\\..+)?")
|
||||
add_definitions (-DHAVE_CONFIG_H=1)
|
||||
include_directories (BEFORE "${_config_path}")
|
||||
endif ("${_config_file}" STREQUAL "config.h")
|
||||
endif ("${_config_file}" MATCHES "config\\.h(\\..+)?")
|
||||
|
||||
# only write the current value of each variable once
|
||||
set (_args ${ARGN})
|
||||
|
@ -17,6 +17,7 @@ macro (opm_dist_clean opm)
|
||||
cmake_install.cmake
|
||||
Makefile
|
||||
config.h
|
||||
config.h.tmp
|
||||
${${opm}_NAME}-config.cmake
|
||||
${${opm}_NAME}-config-version.cmake
|
||||
${${opm}_NAME}-install.cmake
|
||||
|
Loading…
Reference in New Issue
Block a user