mirror of
https://github.com/anope/anope.git
synced 2026-07-02 10:46:37 +02:00
e802b6dfe8
Added CPack setup to automate generation of source package for *nix and NSIS installer for Windows. Some other minor CMake fixes. Converted docs/README and docs/WIN32.txt from Unix linefeeds to DOS linefeeds so they show up right in Notepad under Windows. Added small fix for Visual Studio 2008, CMake doesn't detect the Express version correctly and it must be explicitly defined. git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1861 5417fbe8-f217-4b02-8779-1006273d7864
35 lines
2.4 KiB
CMake
35 lines
2.4 KiB
CMake
# If we are building for Visual Studio OR if the system we are on doesn't have sh (which would be odd on a *nix system...), we'll build a C++ program to create version.h
|
|
if(MSVC OR NOT SH)
|
|
# Set version.sh.c to use C++ as well as set it's compile flags
|
|
set_source_files_properties(version.sh.c PROPERTIES LANGUAGE CXX COMPILE_FLAGS "${CXXFLAGS}")
|
|
# Generate version_sh executable to create version.h from the contents of version.sh, setting it's linker flags as well
|
|
add_executable(version_sh version.sh.c)
|
|
set_target_properties(version_sh PROPERTIES LINKER_LANGUAGE CXX LINK_FLAGS "${LDFLAGS}")
|
|
# Generate version.h from the above executable and the version.log file from the main source directory, with dependencies to the given headers and all source files in the main Anope build
|
|
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/version.h
|
|
COMMAND version_sh ${Anope_SOURCE_DIR}/version.log ${CMAKE_CURRENT_SOURCE_DIR}/version.sh ${CMAKE_CURRENT_BINARY_DIR}/version.h
|
|
MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/version.sh DEPENDS version_sh ${CMAKE_CURRENT_SOURCE_DIR}/services.h ${CMAKE_CURRENT_SOURCE_DIR}/pseudo.h ${CMAKE_CURRENT_SOURCE_DIR}/messages.h ${SRC_SRCS}
|
|
)
|
|
if(IN_SOURCE)
|
|
# Add version_sh to list of files for CPack to ignore
|
|
get_target_property(version_sh_BINARY version_sh LOCATION)
|
|
get_filename_component(version_sh_BINARY ${version_sh_BINARY} NAME)
|
|
add_to_cpack_ignored_files("${version_sh_BINARY}$" TRUE)
|
|
endif(IN_SOURCE)
|
|
# For any non-Visual Studio platforms that do have sh, we will run version.h through the version.h shell script
|
|
else(MSVC OR NOT SH)
|
|
# Generate version.h from version.sh and the version.log file from the main source directory, with dependencies to the given headers and all source files in the main Anope build
|
|
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/version.h
|
|
COMMAND ${SH} ${CMAKE_CURRENT_SOURCE_DIR}/version.sh ${Anope_SOURCE_DIR}/version.log ${CMAKE_CURRENT_BINARY_DIR}/version.h
|
|
MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/version.sh DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/services.h ${CMAKE_CURRENT_SOURCE_DIR}/pseudo.h ${CMAKE_CURRENT_SOURCE_DIR}/messages.h ${SRC_SRCS}
|
|
)
|
|
endif(MSVC OR NOT SH)
|
|
|
|
if(IN_SOURCE)
|
|
# Add version.h to the list of files for CPack to ignore
|
|
add_to_cpack_ignored_files("version.h$" TRUE)
|
|
endif(IN_SOURCE)
|
|
|
|
# Add a custom target to the above file
|
|
add_custom_target(headers DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/version.h)
|