From 3df0f06f4505c6df5c31d7ddb5feddbf3d559ee4 Mon Sep 17 00:00:00 2001 From: Roland Kaufmann Date: Wed, 14 Aug 2013 21:26:28 +0200 Subject: [PATCH] Use OPM_MACROS_ROOT to locate build scripts By using a separate variable for this we can easily grep for where the build system depends on its own location, and also change the policy regarding this later. Note that there is no opm-macros module; this is a "psuedo"-module which links to an additional one (currently, the one we're in) --- cmake/Modules/DuneCompat.cmake | 2 +- cmake/Modules/LibtoolArchives.cmake | 2 +- cmake/Modules/OpmDistClean.cmake | 2 +- cmake/Modules/OpmDoc.cmake | 2 +- cmake/Modules/OpmLibMain.cmake | 6 +++--- cmake/Modules/OpmProject.cmake | 2 +- cmake/Modules/UseVersion.cmake | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cmake/Modules/DuneCompat.cmake b/cmake/Modules/DuneCompat.cmake index e371c832..fb868177 100644 --- a/cmake/Modules/DuneCompat.cmake +++ b/cmake/Modules/DuneCompat.cmake @@ -17,7 +17,7 @@ if (CMAKE_GENERATOR MATCHES "Unix Makefiles") # amazingly, nothing depends on the generated Makefile, so this can be # run whenever in the build without trigging a compile of e.g. config.h add_custom_target (dune-compat ALL - COMMAND ${CMAKE_COMMAND} -DCMAKE_HOME_DIRECTORY=${CMAKE_HOME_DIRECTORY} -P ${PROJECT_SOURCE_DIR}/cmake/Scripts/DuneCompat2.cmake + COMMAND ${CMAKE_COMMAND} -DCMAKE_HOME_DIRECTORY=${CMAKE_HOME_DIRECTORY} -P ${OPM_MACROS_ROOT}/cmake/Scripts/DuneCompat2.cmake COMMENT "Patching Makefile to be DUNE compatible" ) endif (CMAKE_GENERATOR MATCHES "Unix Makefiles") diff --git a/cmake/Modules/LibtoolArchives.cmake b/cmake/Modules/LibtoolArchives.cmake index 8fbc7935..2dc59334 100644 --- a/cmake/Modules/LibtoolArchives.cmake +++ b/cmake/Modules/LibtoolArchives.cmake @@ -141,7 +141,7 @@ function (configure_la name target) # assume that we are in cmake/Modules, and that the template have been # put in cmake/Templates. we cannot use CMAKE_CURRENT_LIST_DIR because # this is in a function, and we cannot know who's calling us - set (templ_dir "${PROJECT_SOURCE_DIR}/cmake/Templates") + set (templ_dir "${OPM_MACROS_ROOT}/cmake/Templates") # only write an .la if libtool is found; otherwise we have no use diff --git a/cmake/Modules/OpmDistClean.cmake b/cmake/Modules/OpmDistClean.cmake index 5d6ebceb..78908370 100644 --- a/cmake/Modules/OpmDistClean.cmake +++ b/cmake/Modules/OpmDistClean.cmake @@ -68,7 +68,7 @@ macro (opm_dist_clean opm) ) endif (NOT PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR) # script to remove empty directories (can't believe this isn't included!) - set (rmdir "${PROJECT_SOURCE_DIR}/cmake/Scripts/RemoveEmptyDir.cmake") + set (rmdir "${OPM_MACROS_ROOT}/cmake/Scripts/RemoveEmptyDir.cmake") add_custom_target (distclean COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR} -- clean COMMAND ${CMAKE_COMMAND} -E remove -f ${DISTCLEAN_FILES} diff --git a/cmake/Modules/OpmDoc.cmake b/cmake/Modules/OpmDoc.cmake index df262ab7..1871c207 100644 --- a/cmake/Modules/OpmDoc.cmake +++ b/cmake/Modules/OpmDoc.cmake @@ -13,7 +13,7 @@ macro (opm_doc opm doxy_dir) # combine the template with local customization - file (READ ${PROJECT_SOURCE_DIR}/cmake/Templates/Doxyfile _doxy_templ) + file (READ ${OPM_MACROS_ROOT}/cmake/Templates/Doxyfile _doxy_templ) string (REPLACE ";" "\\;" _doxy_templ "${_doxy_templ}") if (EXISTS ${PROJECT_SOURCE_DIR}/${doxy_dir}/Doxylocal) file (READ ${PROJECT_SOURCE_DIR}/${doxy_dir}/Doxylocal _doxy_local) diff --git a/cmake/Modules/OpmLibMain.cmake b/cmake/Modules/OpmLibMain.cmake index 6d8764e3..6240cc5d 100644 --- a/cmake/Modules/OpmLibMain.cmake +++ b/cmake/Modules/OpmLibMain.cmake @@ -17,17 +17,17 @@ # include special if (CMAKE_VERSION VERSION_LESS "2.8.3") message (STATUS "Enabling compatibility modules for CMake 2.8.3") - list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/compat-2.8.3") + list (APPEND CMAKE_MODULE_PATH "${OPM_MACROS_ROOT}/cmake/Modules/compat-2.8.3") endif (CMAKE_VERSION VERSION_LESS "2.8.3") if (CMAKE_VERSION VERSION_LESS "2.8.5") message (STATUS "Enabling compatibility modules for CMake 2.8.5") - list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/compat-2.8.5") + list (APPEND CMAKE_MODULE_PATH "${OPM_MACROS_ROOT}/cmake/Modules/compat-2.8.5") endif (CMAKE_VERSION VERSION_LESS "2.8.5") if (CMAKE_VERSION VERSION_LESS "2.8.7") message (STATUS "Enabling compatibility modules for CMake 2.8.7") - list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/compat-2.8.7") + list (APPEND CMAKE_MODULE_PATH "${OPM_MACROS_ROOT}/cmake/Modules/compat-2.8.7") endif (CMAKE_VERSION VERSION_LESS "2.8.7") # don't write default flags into the cache, preserve that for user set values diff --git a/cmake/Modules/OpmProject.cmake b/cmake/Modules/OpmProject.cmake index 4ee05cac..5f80a1a1 100644 --- a/cmake/Modules/OpmProject.cmake +++ b/cmake/Modules/OpmProject.cmake @@ -70,7 +70,7 @@ function (opm_cmake_config name) # assume that the template is located in cmake/Templates (cannot use # the current directory since this is in a function and the directory # at runtime not at definition will be used - set (template_dir "${PROJECT_SOURCE_DIR}/cmake/Templates") + set (template_dir "${OPM_MACROS_ROOT}/cmake/Templates") # write configuration file to locate library configure_cmake_file (${name} "config" "") diff --git a/cmake/Modules/UseVersion.cmake b/cmake/Modules/UseVersion.cmake index b77c5aac..4954edf8 100644 --- a/cmake/Modules/UseVersion.cmake +++ b/cmake/Modules/UseVersion.cmake @@ -39,7 +39,7 @@ else () -DPROJECT_SOURCE_DIR=${PROJECT_SOURCE_DIR} -DPROJECT_BINARY_DIR=${PROJECT_BINARY_DIR} -DPROJECT_LABEL=${${project}_LABEL} - -P ${PROJECT_SOURCE_DIR}/cmake/Scripts/WriteVerSHA.cmake + -P ${OPM_MACROS_ROOT}/cmake/Scripts/WriteVerSHA.cmake COMMENT "Updating version information" )