Skip to content
Permalink
Browse files

Fix the version binary colliding with the C++20 <version> header.

  • Loading branch information...
SaberUK committed Jul 5, 2019
1 parent 523a586 commit 77a52eec7cda1da3787ef0da9964b4c7027844be
Showing with 7 additions and 7 deletions.
  1. +7 −7 include/CMakeLists.txt
@@ -1,16 +1,16 @@
# Set version.cpp to use C++ as well as set its compile flags
set_source_files_properties(version.cpp PROPERTIES LANGUAGE CXX COMPILE_FLAGS "${CXXFLAGS}")
# Generate version executable to modify version.h, setting it's linker flags as well
add_executable(version version.cpp)
set_target_properties(version PROPERTIES LINKER_LANGUAGE CXX LINK_FLAGS "${LDFLAGS}")
get_target_property(version_BINARY version LOCATION)
# Generate version-bin executable to modify version.h, setting it's linker flags as well
add_executable(version-bin version.cpp)
set_target_properties(version-bin PROPERTIES LINKER_LANGUAGE CXX LINK_FLAGS "${LDFLAGS}")
get_target_property(version_BINARY version-bin LOCATION)
# 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 ${CMAKE_CURRENT_BINARY_DIR}/version_build
COMMAND ${version_BINARY} ${Anope_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/version.h ${CMAKE_CURRENT_BINARY_DIR}/build.h
DEPENDS version ${SRC_SRCS}
DEPENDS version-bin ${SRC_SRCS}
)
# Add version to list of files for CPack to ignore
# Add version-bin to list of files for CPack to ignore
get_filename_component(version_BINARY ${version_BINARY} NAME)
add_to_cpack_ignored_files("${version_BINARY}$" TRUE)
if(NOT WIN32)
@@ -61,4 +61,4 @@ if(USE_PCH AND CMAKE_COMPILER_IS_GNUCXX)
endif(USE_PCH AND CMAKE_COMPILER_IS_GNUCXX)

# Add a custom target to the above file
add_custom_target(headers DEPENDS version ${CMAKE_CURRENT_BINARY_DIR}/version_build ${PCH_SOURCES_GCH})
add_custom_target(headers DEPENDS version-bin ${CMAKE_CURRENT_BINARY_DIR}/version_build ${PCH_SOURCES_GCH})

0 comments on commit 77a52ee

Please sign in to comment.
You can’t perform that action at this time.