Change path to auto generated version.h

This is to make it possible to zip just the src/ directory if one wishes
not to use git.
This commit is contained in:
rr- 2016-03-16 17:34:50 +01:00
parent 54571e8bc3
commit 0d91429435

View File

@ -3,6 +3,7 @@ project (opustags)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED on)
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/modules/")
set(CMAKE_SOURCE_DIR "${CMAKE_BINARY_DIR}/../")
# ------------
# Dependencies
@ -22,17 +23,6 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") # for MinGW-w64
endif()
# ------------
# Source files
# ------------
set(CMAKE_SOURCE_DIR "${CMAKE_BINARY_DIR}/../")
file(GLOB_RECURSE common_sources "${CMAKE_SOURCE_DIR}/src/*.cc")
file(GLOB_RECURSE common_headers "${CMAKE_SOURCE_DIR}/src/*.h")
file(GLOB_RECURSE test_sources "${CMAKE_SOURCE_DIR}/tests/*.cc")
file(GLOB_RECURSE test_headers "${CMAKE_SOURCE_DIR}/tests/*.h")
list(REMOVE_ITEM common_sources "${CMAKE_SOURCE_DIR}/src/main.cc")
list(REMOVE_ITEM test_sources "${CMAKE_SOURCE_DIR}/tests/main.cc")
# -------
# Version
# -------
@ -42,8 +32,17 @@ if("${VERSION_SHORT}" STREQUAL "")
set(VERSION_SHORT "0.0")
set(VERSION_LONG "?")
endif()
configure_file("${CMAKE_SOURCE_DIR}/src/version.h.in" "${CMAKE_BINARY_DIR}/generated/version.h" @ONLY)
include_directories(${CMAKE_BINARY_DIR}/generated)
configure_file("${CMAKE_SOURCE_DIR}/src/version.h.in" "${CMAKE_SOURCE_DIR}/src/version.h" @ONLY)
# ------------
# Source files
# ------------
file(GLOB_RECURSE common_sources "${CMAKE_SOURCE_DIR}/src/*.cc")
file(GLOB_RECURSE common_headers "${CMAKE_SOURCE_DIR}/src/*.h")
file(GLOB_RECURSE test_sources "${CMAKE_SOURCE_DIR}/tests/*.cc")
file(GLOB_RECURSE test_headers "${CMAKE_SOURCE_DIR}/tests/*.h")
list(REMOVE_ITEM common_sources "${CMAKE_SOURCE_DIR}/src/main.cc")
list(REMOVE_ITEM test_sources "${CMAKE_SOURCE_DIR}/tests/main.cc")
# -------------------
# 3rd party libraries