summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xConfig10
-rw-r--r--include/CMakeLists.txt9
2 files changed, 13 insertions, 6 deletions
diff --git a/Config b/Config
index deea02258..b28ad3de5 100755
--- a/Config
+++ b/Config
@@ -178,11 +178,17 @@ if [ ! "$NO_INTRO" ] ; then
if [ -d .git ] ; then
VERSION=`git describe --tags`
VERSION_BUILD=`echo "$VERSION" | cut -d'-' -f2`
+ if [ "$SOURCE_DIR" = "." ] ; then
+ test -d build || mkdir -p build/include
+ BUILD_DIR="build"
+ else
+ BUILD_DIR="."
+ fi
VERSION_EXTRA=`echo "$VERSION" | cut -d'-' -f3`
# Only do this if we are not on a tag, src/version.sh will be all we need then.
if [ "$VERSION_BUILD" != "$VERSION_EXTRA" ] ; then
- echo "#define VERSION_BUILD $VERSION_BUILD" > include/version.h
- echo "#define VERSION_EXTRA \"-$VERSION_EXTRA\"" >> include/version.h
+ echo "#define VERSION_BUILD $VERSION_BUILD" > $BUILD_DIR/include/version.h
+ echo "#define VERSION_EXTRA \"-$VERSION_EXTRA\"" >> $BUILD_DIR/include/version.h
fi
fi
cat $SOURCE_DIR/.BANNER | sed "s/CURVER/$VERSION/" | sed "s@SOURCE_DIR@$SOURCE_DIR@" | $PAGER
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
index 233e1d3a5..0205fab95 100644
--- a/include/CMakeLists.txt
+++ b/include/CMakeLists.txt
@@ -4,9 +4,10 @@ set_source_files_properties(version.cpp PROPERTIES LANGUAGE CXX COMPILE_FLAGS "$
add_executable(version version.cpp)
set_target_properties(version PROPERTIES LINKER_LANGUAGE CXX LINK_FLAGS "${LDFLAGS}")
get_target_property(version_BINARY version LOCATION)
-# Modify version.h from the above executable, with dependencies to the given headers, version.cpp, and all source files in the main Anope build
-add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/version.h
- COMMAND ${version_BINARY} ${Anope_SOURCE_DIR}/src/version.sh ${CMAKE_CURRENT_SOURCE_DIR}/version.h
+# Modify version.h from the above executable, with dependencies to version.cpp
+# and all of the source files in the main build
+add_custom_command(OUTPUT version_build
+ COMMAND ${version_BINARY} ${Anope_SOURCE_DIR}/src/version.sh ${CMAKE_CURRENT_BINARY_DIR}/version.h
DEPENDS version ${SRC_SRCS}
)
# Add version to list of files for CPack to ignore
@@ -44,4 +45,4 @@ if(CMAKE_COMPILER_IS_GNUCXX)
endif(CMAKE_COMPILER_IS_GNUCXX)
# Add a custom target to the above file
-add_custom_target(headers DEPENDS version ${CMAKE_CURRENT_BINARY_DIR}/version.h ${PCH_SOURCES_GCH})
+add_custom_target(headers DEPENDS version version_build ${PCH_SOURCES_GCH})