Enable building as a link in dunecontrol chain

Dunecontrol scans the module directory for certain files and phrases
which must be present if the project can be used as a dependency for
other DUNE modules.
This commit is contained in:
Roland Kaufmann committed 2013-02-11 23:06:37 +01:00
1 parent fdff36fcbf
commit 46975fc130
3 files changed
+44

No files matched your search

+3
View File
@@ -446,3 +446,6 @@ file (COPY
GNUmakefile
DESTINATION ${PROJECT_BINARY_DIR}
)
# provide compatibility with using this build in dunecontrol
include (DuneCompat)
+23
View File
@@ -0,0 +1,23 @@
# - Dunecontrol compatibility
#
# Enables this build to be a part of a dunecontrol chain. The
# DUNE_CHECK_MODULES macro greps the top-level Makefile for the
# presence of the abs_top_srcdir variable (!) and uses that as
# the include directory of a module. Also, the contents are not
# checked so if the variable is not present, it generates an
# invalid command line (-I without argument) which causes the
# autoconf probe to fail. This module patches our Makefile (!!)
# so the necessary string will be there; in itself this string
# has no use for us, it is solemnly to satisfy the M4 scripts.
if (CMAKE_GENERATOR MATCHES "Unix Makefiles")
# we need an up-to-date, patched Makefile. this is always checked when
# the makefile is run, thus the need for a marker file to keep a
# timestamp to see when it was last patched (by us)
# 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
COMMENT "Patching Makefile to be DUNE compatible"
)
endif (CMAKE_GENERATOR MATCHES "Unix Makefiles")
+18
View File
@@ -0,0 +1,18 @@
# - Emulate a rule to patch the Makefile, adding a line to the source
# tree and write a marker file indicating it is done.
set (base_dir ".")
set (marker_file "${base_dir}/CMakeFiles/marker")
set (makefile "${base_dir}/Makefile")
# if the Makefile has changed, then update it and touch the marker so that
# the marker is newer and won't update the Makefile again
if ("${makefile}" IS_NEWER_THAN "${marker_file}")
file (APPEND "${makefile}"
"abs_top_srcdir = ${CMAKE_HOME_DIRECTORY}\n"
)
execute_process (COMMAND
${CMAKE_COMMAND} -E touch "${marker_file}"
)
endif ("${makefile}" IS_NEWER_THAN "${marker_file}")