Merge pull request #204 from rolk/204_precomp
Allow precompiled headers to be enabled from command-line
This commit is contained in:
commit
d86b4c09a4
@ -51,6 +51,14 @@ foreach (name IN LISTS _opm_proj_vars)
|
||||
endif (NOT DEFINED ${CMAKE_PROJECT_NAME}_${name})
|
||||
endforeach (name)
|
||||
|
||||
# these dependencies must always be handled by the find module
|
||||
set (_opm_proj_exemptions
|
||||
dune-common
|
||||
dune-istl
|
||||
dune-grid
|
||||
dune-geometry
|
||||
)
|
||||
|
||||
# insert this boilerplate whenever we are going to find a new package
|
||||
macro (find_and_append_package_to prefix name)
|
||||
# if we have specified a directory, don't revert to searching the
|
||||
@ -71,6 +79,28 @@ macro (find_and_append_package_to prefix name)
|
||||
set (${name}_DIR "${${NAME}_ROOT}")
|
||||
endif (EXISTS ${${NAME}_ROOT}/${name}-config.cmake OR EXISTS ${${NAME}_ROOT}/${name}Config.cmake)
|
||||
endif (NOT DEFINED ${name}_DIR AND (DEFINED ${name}_ROOT OR DEFINED ${NAME}_ROOT))
|
||||
|
||||
# these libraries need special handling which is not provided in
|
||||
# the -config.cmake file, but which must be provided by this project,
|
||||
# something which is done in our find module
|
||||
list (FIND _opm_proj_exemptions "${name}" _${name}_exempted)
|
||||
if ((NOT (_${name}_exempted EQUAL -1)) AND (DEFINED ${name}_DIR))
|
||||
# most often we are given the name to the build directory and this
|
||||
# is a sub-directory of the source tree
|
||||
if (${name}_DIR MATCHES "build")
|
||||
get_filename_component (${name}_ROOT "${${name}_DIR}" PATH)
|
||||
else (${name}_DIR MATCHES "build")
|
||||
set (${name}_ROOT "${${name}_DIR}")
|
||||
endif (${name}_DIR MATCHES "build")
|
||||
# store this for later, in case we reconfigure
|
||||
set (${name}_ROOT "${${name}_ROOT}" CACHE LOCATION "Path to ${name}")
|
||||
# clear this to not use config mode
|
||||
unset (${name}_DIR)
|
||||
# variables that are given on the command-line is also put in the cache
|
||||
# removing the local copy only "unshadows" this one
|
||||
unset (${name}_DIR CACHE)
|
||||
endif ((NOT (_${name}_exempted EQUAL -1)) AND (DEFINED ${name}_DIR))
|
||||
|
||||
# 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
|
||||
|
@ -85,14 +85,16 @@ macro (find_opm_package module deps header lib defs prog conf)
|
||||
string (TOLOWER "${module}" _module_lower)
|
||||
set (_guess
|
||||
"../${module}"
|
||||
"../${module}-build"
|
||||
"../${_module_lower}"
|
||||
)
|
||||
set (_guess_bin_only
|
||||
"../${module}-build"
|
||||
"../${_module_lower}-build"
|
||||
"../../${module}/build-cmake"
|
||||
"../../${_module_lower}/build-cmake"
|
||||
)
|
||||
set (_guess_bin)
|
||||
foreach (_item IN ITEMS ${_guess})
|
||||
foreach (_item IN ITEMS ${_guess} ${_guess_bin_only})
|
||||
list (APPEND _guess_bin "${PROJECT_BINARY_DIR}/${_item}")
|
||||
endforeach (_item)
|
||||
endif (NOT (${module}_DIR OR ${module}_ROOT OR ${MODULE}_ROOT))
|
||||
@ -116,7 +118,7 @@ macro (find_opm_package module deps header lib defs prog conf)
|
||||
NAMES "${lib}"
|
||||
PATHS ${_guess_bin}
|
||||
HINTS ${${module}_DIR} ${${module}_ROOT} ${${MODULE}_ROOT} ${PkgConf_${module}_LIBRARY_DIRS}
|
||||
PATH_SUFFIXES "lib" "lib/.libs" ".libs" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
|
||||
PATH_SUFFIXES "lib" "lib/.libs" ".libs" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}" "build-cmake/lib"
|
||||
)
|
||||
else (NOT "${lib}" STREQUAL "")
|
||||
set (${module}_LIBRARY "")
|
||||
|
4
configure
vendored
4
configure
vendored
@ -271,6 +271,10 @@ for OPT in "$@"; do
|
||||
# special flag; don't set shared/static
|
||||
shared=""
|
||||
;;
|
||||
pch)
|
||||
pch_use=" -DPRECOMPILE_HEADERS:BOOL=ON"
|
||||
shared=""
|
||||
;;
|
||||
# this flag is just for compatibility with the deprecation
|
||||
# flag in DUNE, so we can build without warnings
|
||||
fieldvector-size-is-method)
|
||||
|
Loading…
Reference in New Issue
Block a user