mirror of
https://github.com/anope/anope.git
synced 2026-06-25 16:46:37 +02:00
Remove the repeated conditions in cmake endif/else statements.
This commit is contained in:
+97
-97
@@ -4,11 +4,11 @@ if(COMMAND cmake_policy)
|
||||
cmake_policy(SET CMP0003 NEW)
|
||||
if(POLICY CMP0026)
|
||||
cmake_policy(SET CMP0026 OLD)
|
||||
endif(POLICY CMP0026)
|
||||
endif()
|
||||
if(POLICY CMP0007)
|
||||
cmake_policy(SET CMP0007 OLD)
|
||||
endif(POLICY CMP0007)
|
||||
endif(COMMAND cmake_policy)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Set the project as C++ primarily, but have C enabled for the checks required later
|
||||
project(Anope CXX)
|
||||
@@ -21,21 +21,21 @@ string(REGEX MATCH "-patch .*$" HAS_PATCH "${ONLY_VERSION}")
|
||||
if(HAS_PATCH)
|
||||
string(REGEX REPLACE "(.*)-patch .*" "\\1" MINOR_VERSION "${ONLY_VERSION}")
|
||||
string(REGEX REPLACE ".*-patch (.*)" "\\1" PATCH_VERSION "${ONLY_VERSION}")
|
||||
else(HAS_PATCH)
|
||||
else()
|
||||
string(REGEX MATCH "\\." HAS_DOT "${ONLY_VERSION}")
|
||||
if(HAS_DOT)
|
||||
string(REGEX REPLACE "(.*)\\..*" "\\1" MINOR_VERSION "${ONLY_VERSION}")
|
||||
string(REGEX REPLACE ".*\\.(.*)" "\\1" PATCH_VERSION "${ONLY_VERSION}")
|
||||
else(HAS_DOT)
|
||||
else()
|
||||
string(REGEX REPLACE "(.*)-beta" "\\1" MINOR_VERSION "${ONLY_VERSION}")
|
||||
if(MINOR_VERSION STREQUAL "4-1\n")
|
||||
set(PATCH_VERSION 1)
|
||||
else(MINOR_VERSION STREQUAL "4-1\n")
|
||||
else()
|
||||
set(PATCH_VERSION 0)
|
||||
endif(MINOR_VERSION STREQUAL "4-1\n")
|
||||
endif()
|
||||
set(MINOR_VERSION 4)
|
||||
endif(HAS_DOT)
|
||||
endif(HAS_PATCH)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Detect is we are using CMake 2.6 or better, these versions include functions that require less work than CMake 2.4 does
|
||||
if(MINOR_VERSION GREATER 5)
|
||||
@@ -43,30 +43,30 @@ if(MINOR_VERSION GREATER 5)
|
||||
set(CMAKE248_OR_BETTER TRUE)
|
||||
set(CMAKE244_OR_BETTER TRUE)
|
||||
set(CMAKE242_OR_BETTER TRUE)
|
||||
else(MINOR_VERSION GREATER 5)
|
||||
else()
|
||||
set(CMAKE26_OR_BETTER FALSE)
|
||||
# Also detect if we are using CMake 2.4.8 or better, the FIND sub-command of list() is nonexistent in earlier versions
|
||||
if(PATCH_VERSION GREATER 7)
|
||||
set(CMAKE248_OR_BETTER TRUE)
|
||||
set(CMAKE244_OR_BETTER TRUE)
|
||||
set(CMAKE242_OR_BETTER TRUE)
|
||||
else(PATCH_VERSION GREATER 7)
|
||||
else()
|
||||
set(CMAKE248_OR_BETTER FALSE)
|
||||
# Also detect if we are using CMake 2.4.4 or better, the CheckCXXCompilerFlag module and SORT sub-command of list() are nonexistent in earlier versions
|
||||
if(PATCH_VERSION GREATER 3)
|
||||
set(CMAKE244_OR_BETTER TRUE)
|
||||
set(CMAKE242_OR_BETTER TRUE)
|
||||
else(PATCH_VERSION GREATER 3)
|
||||
else()
|
||||
set(CMAKE244_OR_BETTER FALSE)
|
||||
# ALSO detect if we are using CMake 2.4.2 or better, the APPEND sub-command of list() is nonexistent in earlier versions
|
||||
if(PATCH_VERSION GREATER 1)
|
||||
set(CMAKE242_OR_BETTER TRUE)
|
||||
else(PATCH_VERSION GREATER 1)
|
||||
else()
|
||||
set(CMAKE242_OR_BETTER FALSE)
|
||||
endif(PATCH_VERSION GREATER 1)
|
||||
endif(PATCH_VERSION GREATER 3)
|
||||
endif(PATCH_VERSION GREATER 7)
|
||||
endif(MINOR_VERSION GREATER 5)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Override the module include path to include our directory, for our Anope.cmake, as well as we are using our own version of the NSIS template
|
||||
set(CMAKE_MODULE_PATH ${Anope_SOURCE_DIR}/cmake)
|
||||
@@ -86,11 +86,11 @@ if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
string(REGEX REPLACE "^(\\d+\\.\\d+)" "\\1" GCC_VERSION ${GCC_FULL_VERSION})
|
||||
if(GCC_VERSION LESS 4.2)
|
||||
message(FATAL_ERROR "Your compiler is too old to build Anope. Upgrade to GCC 4.2 or newer!")
|
||||
endif(GCC_VERSION LESS 4.2)
|
||||
endif()
|
||||
if(GCC_VERSION GREATER 6.0 OR GCC_VERSION EQUAL 6.0)
|
||||
set(CXXFLAGS "${CXXFLAGS} -fno-delete-null-pointer-checks")
|
||||
endif(GCC_VERSION GREATER 6.0 OR GCC_VERSION EQUAL 6.0)
|
||||
endif(CMAKE_COMPILER_IS_GNUCXX)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# If we are using a GNU compiler (have to use CXX because it seems to fail on C), we will be able to determine it's default paths for libraries and includes
|
||||
if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang$")
|
||||
@@ -101,9 +101,9 @@ if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang$")
|
||||
# Replace the colons in the list with semicolons (only when not on MinGW, which uses semicolons already), and if on MinGW, just copy the line
|
||||
if(NOT MINGW)
|
||||
string(REGEX REPLACE ":" ";" LIBRARIES ${LINE})
|
||||
else(NOT MINGW)
|
||||
else()
|
||||
set(LIBRARIES "${LINE}")
|
||||
endif(NOT MINGW)
|
||||
endif()
|
||||
# Iterate through the libraries
|
||||
foreach(LIBRARY ${LIBRARIES})
|
||||
# Check if the first character is an equal sign, and skip that library directory as it is (I believe) the primary default and shows up later in the list anyways
|
||||
@@ -112,12 +112,12 @@ if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang$")
|
||||
# If the directory had no = in front of it, make sure it's absolute and add it to the list of default library directories
|
||||
get_filename_component(LIBRARY ${LIBRARY} ABSOLUTE)
|
||||
append_to_list(DEFAULT_LIBRARY_DIRS ${LIBRARY})
|
||||
endif(NOT FIRST_CHAR STREQUAL "=")
|
||||
endforeach(LIBRARY)
|
||||
endif()
|
||||
endforeach()
|
||||
# Remove duplicate entries from the list
|
||||
if(DEFAULT_LIBRARY_DIRS)
|
||||
remove_list_duplicates(DEFAULT_LIBRARY_DIRS)
|
||||
endif(DEFAULT_LIBRARY_DIRS)
|
||||
endif()
|
||||
# Create a temporary file to test for the default include directories
|
||||
FILE(WRITE empty.cpp "")
|
||||
# Next, we look for the compiler's default include directories
|
||||
@@ -134,11 +134,11 @@ if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang$")
|
||||
# If the line has the following on it, the next lines will contain directory names
|
||||
if(LINE STREQUAL "#include <...> search starts here:")
|
||||
set(IN_SEARCH TRUE)
|
||||
else(LINE STREQUAL "#include <...> search starts here:")
|
||||
else()
|
||||
# If the line has the following on it, we hit the end of the list
|
||||
if(LINE STREQUAL "End of search list.")
|
||||
set(IN_SEARCH FALSE)
|
||||
else(LINE STREQUAL "End of search list.")
|
||||
else()
|
||||
# If we are within the block between the above two lines...
|
||||
if(IN_SEARCH)
|
||||
# Get everything but the first character of the line
|
||||
@@ -151,15 +151,15 @@ if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang$")
|
||||
get_filename_component(INCLUDE ${INCLUDE} ABSOLUTE)
|
||||
# Add that directory to the list of default include directories
|
||||
append_to_list(DEFAULT_INCLUDE_DIRS ${INCLUDE})
|
||||
endif(IN_SEARCH)
|
||||
endif(LINE STREQUAL "End of search list.")
|
||||
endif(LINE STREQUAL "#include <...> search starts here:")
|
||||
endforeach(LINE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
# Remove duplicate entries from the list
|
||||
if(DEFAULT_INCLUDE_DIRS)
|
||||
remove_list_duplicates(DEFAULT_INCLUDE_DIRS)
|
||||
endif(DEFAULT_INCLUDE_DIRS)
|
||||
endif(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang$")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# If we are using Visual Studio, locate the path of the Windows Server 2008 SDK or Windows Server 2003 Platform SDK, depending on which is installed
|
||||
if(MSVC)
|
||||
@@ -178,19 +178,19 @@ if(MSVC)
|
||||
if(WSDK2003_PATH STREQUAL "/registry")
|
||||
# The SDK was never found, set the path to nothing
|
||||
set(WSDK_PATH "")
|
||||
else(WSDK2003_PATH STREQUAL "/registry")
|
||||
else()
|
||||
set(WSDK_PATH "${WSDK2003_PATH}")
|
||||
endif(WSDK2003_PATH STREQUAL "/registry")
|
||||
else(WSDK2008_PATH STREQUAL "/registry")
|
||||
endif()
|
||||
else()
|
||||
set(WSDK_PATH "${WSDK2008_PATH}")
|
||||
endif(WSDK2008_PATH STREQUAL "/registry")
|
||||
else(WSDK2003_PATH STREQUAL "/registry")
|
||||
endif()
|
||||
else()
|
||||
set(WSDK_PATH "${WSDK2003_PATH}")
|
||||
endif(WSDK2003_PATH STREQUAL "/registry")
|
||||
else(WSDK2008_PATH STREQUAL "/registry")
|
||||
endif()
|
||||
else()
|
||||
set(WSDK_PATH "${WSDK2008_PATH}")
|
||||
endif(WSDK2008_PATH STREQUAL "/registry")
|
||||
endif(MSVC)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# If the user specifies -DCMAKE_BUILD_TYPE on the command line, take their definition
|
||||
# and dump it in the cache along with proper documentation, otherwise set CMAKE_BUILD_TYPE
|
||||
@@ -199,17 +199,17 @@ endif(MSVC)
|
||||
if(NOT MSVC)
|
||||
if(CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.")
|
||||
else(CMAKE_BUILD_TYPE)
|
||||
else()
|
||||
set(CMAKE_BUILD_TYPE DEBUG CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.")
|
||||
endif(CMAKE_BUILD_TYPE)
|
||||
endif(NOT MSVC)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# If running under MinGW, we have to force the resource compiler settings (hopefully this will be fixed in a later version of CMake)
|
||||
if(MINGW)
|
||||
set(CMAKE_RC_COMPILER_INIT windres)
|
||||
enable_language(RC)
|
||||
set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> <FLAGS> <DEFINES> -o <OBJECT> <SOURCE>")
|
||||
endif(MINGW)
|
||||
endif()
|
||||
|
||||
# Include the checking functions used later in this CMakeLists.txt
|
||||
include(CheckFunctionExists)
|
||||
@@ -218,19 +218,19 @@ include(CheckTypeSize)
|
||||
include(CheckLibraryExists)
|
||||
if(CMAKE244_OR_BETTER)
|
||||
include(CheckCXXCompilerFlag)
|
||||
else(CMAKE244_OR_BETTER)
|
||||
else()
|
||||
include(TestCXXAcceptsFlag)
|
||||
endif(CMAKE244_OR_BETTER)
|
||||
endif()
|
||||
|
||||
# If extra include directories were specified, tell cmake about them.
|
||||
if(EXTRA_INCLUDE)
|
||||
include_directories(${EXTRA_INCLUDE})
|
||||
endif(EXTRA_INCLUDE)
|
||||
endif()
|
||||
|
||||
# If extra library directories were specified, tell cmake about them.
|
||||
if(EXTRA_LIBS)
|
||||
link_directories(${EXTRA_LIBS})
|
||||
endif(EXTRA_LIBS)
|
||||
endif()
|
||||
|
||||
# Find gettext
|
||||
find_package(Gettext)
|
||||
@@ -245,14 +245,14 @@ include_directories(${Anope_BINARY_DIR}/include ${Anope_SOURCE_DIR}/include ${An
|
||||
# Pass on REPRODUCIBLE_BUILD
|
||||
if(REPRODUCIBLE_BUILD)
|
||||
add_definitions(-DREPRODUCIBLE_BUILD)
|
||||
endif(REPRODUCIBLE_BUILD)
|
||||
endif()
|
||||
|
||||
# If using Windows, always add the _WIN32 define
|
||||
if(WIN32)
|
||||
add_definitions(-D_WIN32)
|
||||
# And include the windows specific folder for our anope_windows.h
|
||||
include_directories(${Anope_SOURCE_DIR}/src/win32)
|
||||
endif(WIN32)
|
||||
endif()
|
||||
|
||||
# If using Visual Studio, set the C++ flags accordingly
|
||||
if(MSVC)
|
||||
@@ -264,7 +264,7 @@ if(MSVC)
|
||||
set(CXXFLAGS "${CXXFLAGS} /W4 /wd4100 /wd4127 /wd4250 /wd4251 /wd4355 /wd4706 /wd4800 /wd4996 /EHs")
|
||||
add_definitions(-DMSVCPP -D_CRT_SECURE_NO_WARNINGS)
|
||||
# Otherwise, we're not using Visual Studio
|
||||
else(MSVC)
|
||||
else()
|
||||
# Set the compile flags to have all warnings on (including shadowed variables)
|
||||
set(CXXFLAGS "${CXXFLAGS} -Wall -Wshadow")
|
||||
# If on a *nix system, also set the compile flags to remove GNU extensions (favor ISO C++) as well as reject non-ISO C++ code, also remove all leading underscores in exported symbols (only on GNU compiler)
|
||||
@@ -272,29 +272,29 @@ else(MSVC)
|
||||
set(CXXFLAGS "${CXXFLAGS} -ansi -pedantic ${CMAKE_CXX_FLAGS}")
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
set(CXXFLAGS "${CXXFLAGS} -Wno-long-long -fno-leading-underscore")
|
||||
endif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
endif()
|
||||
# If we aren't on a *nix system, we are using MinGW
|
||||
else(UNIX)
|
||||
else()
|
||||
# Also, if we are building under MinGW, add another define for MinGW
|
||||
if(MINGW)
|
||||
add_definitions(-DMINGW)
|
||||
endif(MINGW)
|
||||
endif(UNIX)
|
||||
endif(MSVC)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# If CMake has found that the given system requires a special library for dl* calls, include it with the linker flags
|
||||
if(CMAKE_DL_LIBS)
|
||||
append_to_list(LINK_LIBS ${CMAKE_DL_LIBS})
|
||||
endif(CMAKE_DL_LIBS)
|
||||
endif()
|
||||
|
||||
# Under MinGW, the -shared flag isn't properly set in the module-specific linker flags, add it from the C flags for shared libraries
|
||||
if(MINGW)
|
||||
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS}")
|
||||
endif(MINGW)
|
||||
endif()
|
||||
|
||||
if(NOT PROGRAM_NAME)
|
||||
set(PROGRAM_NAME anope)
|
||||
endif(NOT PROGRAM_NAME)
|
||||
endif()
|
||||
|
||||
# If we are not using Visual Studio, we'll run the following checks
|
||||
if(NOT MSVC)
|
||||
@@ -302,14 +302,14 @@ if(NOT MSVC)
|
||||
if(CMAKE244_OR_BETTER)
|
||||
# If using CMake 2.4.4 or better, we can use check_cxx_compiler_flag
|
||||
check_cxx_compiler_flag(-pipe HAVE_PIPE_FLAG)
|
||||
else(CMAKE244_OR_BETTER)
|
||||
else()
|
||||
# If using CMake 2.4.3 or older, we will use check_cxx_accepts_flags instead
|
||||
check_cxx_accepts_flag(-pipe HAVE_PIPE_FLAG)
|
||||
endif(CMAKE244_OR_BETTER)
|
||||
endif()
|
||||
# If the flag was accepted, add it to the list of flags
|
||||
if(HAVE_PIPE_FLAG)
|
||||
set(CXXFLAGS "${CXXFLAGS} -pipe")
|
||||
endif(HAVE_PIPE_FLAG)
|
||||
endif()
|
||||
|
||||
# The following are additional library checks, they are not required for Windows
|
||||
if(NOT WIN32)
|
||||
@@ -317,37 +317,37 @@ if(NOT MSVC)
|
||||
check_library_exists(socket socket "" HAVE_SOCKET_LIB)
|
||||
if(HAVE_SOCKET_LIB)
|
||||
append_to_list(LINK_LIBS socket)
|
||||
endif(HAVE_SOCKET_LIB)
|
||||
endif()
|
||||
# Check if inet_addr is within the nsl library (if the library exists), and add it to the linker flags if needed
|
||||
check_library_exists(nsl inet_addr "" HAVE_NSL_LIB)
|
||||
if(HAVE_NSL_LIB)
|
||||
append_to_list(LINK_LIBS nsl)
|
||||
endif(HAVE_NSL_LIB)
|
||||
endif()
|
||||
# Check if pthread_create is within the pthread library (if the library exists), and add it to the linker flags if needed
|
||||
check_library_exists(pthread pthread_create "" HAVE_PTHREAD)
|
||||
if(HAVE_PTHREAD)
|
||||
if(NOT APPLE)
|
||||
set(LDFLAGS "${LDFLAGS} -pthread")
|
||||
endif(NOT APPLE)
|
||||
else(HAVE_PTHREAD)
|
||||
endif()
|
||||
else()
|
||||
message(FATAL_ERROR "The pthread library is required to build Anope")
|
||||
endif(HAVE_PTHREAD)
|
||||
endif(NOT WIN32)
|
||||
endif(NOT MSVC)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# If DEFUMASK wasn't passed to CMake, set a default depending on if RUNGROUP was passed in or not
|
||||
if(NOT DEFUMASK)
|
||||
if(RUNGROUP)
|
||||
set(DEFUMASK "007")
|
||||
else(RUNGROUP)
|
||||
else()
|
||||
set(DEFUMASK "077")
|
||||
endif(RUNGROUP)
|
||||
endif(NOT DEFUMASK)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Set the DEBUG_BUILD for sysconf.h
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "DEBUG" OR CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINFO")
|
||||
set(DEBUG_BUILD TRUE)
|
||||
endif(CMAKE_BUILD_TYPE STREQUAL "DEBUG" OR CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINFO")
|
||||
endif()
|
||||
|
||||
# Check for the existence of the following include files
|
||||
check_include_file(cstdint HAVE_CSTDINT)
|
||||
@@ -364,11 +364,11 @@ check_function_exists(kqueue HAVE_KQUEUE)
|
||||
# Strip the leading and trailing spaces from the compile flags
|
||||
if(CXXFLAGS)
|
||||
strip_string(${CXXFLAGS} CXXFLAGS)
|
||||
endif(CXXFLAGS)
|
||||
endif()
|
||||
# Strip the leading and trailing spaces from the linker flags
|
||||
if(LDFLAGS)
|
||||
strip_string(${LDFLAGS} LDFLAGS)
|
||||
endif(LDFLAGS)
|
||||
endif()
|
||||
|
||||
# Search for the following programs
|
||||
find_program(GREP grep)
|
||||
@@ -381,30 +381,30 @@ if(INSTDIR)
|
||||
set(CMAKE_INSTALL_PREFIX "${INSTDIR}")
|
||||
elseif(NOT CMAKE_INSTALL_PREFIX)
|
||||
set(CMAKE_INSTALL_PREFIX "$ENV{HOME}/anope")
|
||||
endif(INSTDIR)
|
||||
endif()
|
||||
|
||||
# Set default paths for various directories if not already defined
|
||||
if(NOT BIN_DIR)
|
||||
set(BIN_DIR "bin")
|
||||
endif(NOT BIN_DIR)
|
||||
endif()
|
||||
if(NOT DB_DIR)
|
||||
set(DB_DIR "data")
|
||||
endif(NOT DB_DIR)
|
||||
endif()
|
||||
if(NOT DOC_DIR)
|
||||
set(DOC_DIR "doc")
|
||||
endif(NOT DOC_DIR)
|
||||
endif()
|
||||
if(NOT CONF_DIR)
|
||||
set(CONF_DIR "conf")
|
||||
endif(NOT CONF_DIR)
|
||||
endif()
|
||||
if(NOT LIB_DIR)
|
||||
set(LIB_DIR "lib")
|
||||
endif(NOT LIB_DIR)
|
||||
endif()
|
||||
if(NOT LOCALE_DIR)
|
||||
set(LOCALE_DIR "locale")
|
||||
endif(NOT LOCALE_DIR)
|
||||
endif()
|
||||
if(NOT LOGS_DIR)
|
||||
set(LOGS_DIR "logs")
|
||||
endif(NOT LOGS_DIR)
|
||||
endif()
|
||||
|
||||
# Version number processing
|
||||
# Find all lines in src/version.sh that start with VERSION_
|
||||
@@ -418,8 +418,8 @@ foreach(VERSION_STR ${VERSIONS})
|
||||
if(${VERSION_LEN} GREATER 1)
|
||||
list(GET VERSION_OUT 1 VERSION_DATA)
|
||||
set(VERSION_${VERSION_TYPE} ${VERSION_DATA})
|
||||
endif(${VERSION_LEN} GREATER 1)
|
||||
endforeach(VERSION_STR ${VERSIONS})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Default build version to 0
|
||||
set(VERSION_BUILD 0)
|
||||
@@ -437,8 +437,8 @@ if(EXISTS "${Anope_SOURCE_DIR}/include/version.h")
|
||||
string(SUBSTRING ${VERSION_STR} 22 ${VERSION_NUM_LEN} VERSION)
|
||||
# Set VERSION_BUILD correctly
|
||||
set(VERSION_BUILD ${VERSION})
|
||||
endforeach(VERSION_STR ${VERSIONS})
|
||||
endif(EXISTS "${Anope_SOURCE_DIR}/include/version.h")
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
# Set the version variables based on what was found above
|
||||
set(VERSION_COMMA "${VERSION_MAJOR},${VERSION_MINOR},${VERSION_PATCH},${VERSION_BUILD}")
|
||||
@@ -451,7 +451,7 @@ set(VERSION_FULL_NOBUILD "${VERSION_DOTTED_NOBUILD}${VERSION_EXTRA}")
|
||||
if(WIN32)
|
||||
# Generate the win32.rc file using the above variables
|
||||
configure_file(${Anope_SOURCE_DIR}/src/win32/win32.rc.cmake ${Anope_BINARY_DIR}/src/win32/win32.rc)
|
||||
endif(WIN32)
|
||||
endif()
|
||||
|
||||
# Add the initial files to ignore which will be ignored regardless of if you are building in-source or out-of-source
|
||||
add_to_cpack_ignored_files(".git\;config.cache\;CMakeFiles\;sysconf.h$\;build" TRUE)
|
||||
@@ -466,8 +466,8 @@ if(${Anope_SOURCE_DIR} STREQUAL ${Anope_BINARY_DIR})
|
||||
# If using Visual Studio, add these files as well
|
||||
if(MSVC)
|
||||
add_to_cpack_ignored_files(".vcproj$\;.sln$\;.ncb$\;.suo$\;.dir$\;.ilk$\;.exp$\;.pdb$\;.lib$\;/debug$;/release$;/relwithdebinfo$;/minsizerel$" TRUE)
|
||||
endif(MSVC)
|
||||
endif(${Anope_SOURCE_DIR} STREQUAL ${Anope_BINARY_DIR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Go into the following directories and run their CMakeLists.txt as well
|
||||
add_subdirectory(data)
|
||||
@@ -486,13 +486,13 @@ install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${DB_
|
||||
install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${LOGS_DIR}\")")
|
||||
if(WIN32)
|
||||
install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${DB_DIR}/runtime\")")
|
||||
endif(WIN32)
|
||||
endif()
|
||||
# On non-Windows platforms, if RUNGROUP is set, change the permissions of the below directories, as well as the group of the data directory
|
||||
if(NOT WIN32 AND RUNGROUP)
|
||||
install(CODE "execute_process(COMMAND ${CHMOD} 2775 \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/\${DB_DIR}/backups\")")
|
||||
install(CODE "execute_process(COMMAND ${CHMOD} 2775 \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/\${LOGS_DIR}\")")
|
||||
install(CODE "execute_process(COMMAND ${CHGRP} -R ${RUNGROUP} \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}\")")
|
||||
endif(NOT WIN32 AND RUNGROUP)
|
||||
endif()
|
||||
# On Windows platforms, install extra files
|
||||
if(WIN32)
|
||||
install(FILES ${Anope_SOURCE_DIR}/src/win32/anope.bat
|
||||
@@ -502,7 +502,7 @@ if(WIN32)
|
||||
# Package any DLLs in src/win/
|
||||
file(GLOB EXTRA_DLLS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "${Anope_SOURCE_DIR}/src/win32/*.dll")
|
||||
install(FILES ${EXTRA_DLLS} DESTINATION ${BIN_DIR})
|
||||
endif(WIN32)
|
||||
endif()
|
||||
|
||||
install(CODE "file(REMOVE_RECURSE \"$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${LIB_DIR}/modules\")")
|
||||
|
||||
@@ -543,10 +543,10 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
|
||||
set(CPACK_NSIS_INSTALLED_ICON_NAME "${SERVICES_BINARY}")
|
||||
set(CPACK_NSIS_URL_INFO_ABOUT "https://www.anope.org/")
|
||||
set(CPACK_NSIS_COMPRESSOR "/SOLID lzma")
|
||||
endif(WIN32)
|
||||
endif()
|
||||
set(CPACK_SOURCE_PACKAGE_FILE_NAME "anope-${VERSION_FULL_NOBUILD}-source")
|
||||
set(CPACK_SOURCE_GENERATOR "TGZ")
|
||||
set(CPACK_SOURCE_IGNORE_FILES "$ENV{CPACK_IGNORED_FILES}")
|
||||
set(CPACK_MONOLITHIC_INSTALL TRUE)
|
||||
include(CPack)
|
||||
endif(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
|
||||
endif()
|
||||
|
||||
+115
-115
@@ -9,37 +9,37 @@ macro(strip_string INPUT_STRING OUTPUT_STRING)
|
||||
if(CMAKE26_OR_BETTER)
|
||||
# For CMake 2.6.x or better, we can just use the STRIP sub-command of string()
|
||||
string(STRIP ${INPUT_STRING} ${OUTPUT_STRING})
|
||||
else(CMAKE26_OR_BETTER)
|
||||
else()
|
||||
# For CMake 2.4.x, we will have to use the REGEX REPLACE sub-command of string() instead
|
||||
# First check if the input string is empty or not
|
||||
if (${INPUT_STRING} STREQUAL "")
|
||||
set(${OUTPUT_STRING} "")
|
||||
else(${INPUT_STRING} STREQUAL "")
|
||||
else()
|
||||
# Determine if the string is entirely empty or not
|
||||
string(REGEX MATCH "^[ \t]*$" EMPTY_STRING "${INPUT_STRING}")
|
||||
if(EMPTY_STRING)
|
||||
set(${OUTPUT_STRING} "")
|
||||
else(EMPTY_STRING)
|
||||
else()
|
||||
# We detect if there is any leading whitespace and remove any if there is
|
||||
string(SUBSTRING "${INPUT_STRING}" 0 1 FIRST_CHAR)
|
||||
if(FIRST_CHAR STREQUAL " " OR FIRST_CHAR STREQUAL "\t")
|
||||
string(REGEX REPLACE "^[ \t]+" "" TEMP_STRING "${INPUT_STRING}")
|
||||
else(FIRST_CHAR STREQUAL " " OR FIRST_CHAR STREQUAL "\t")
|
||||
else()
|
||||
set(TEMP_STRING "${INPUT_STRING}")
|
||||
endif(FIRST_CHAR STREQUAL " " OR FIRST_CHAR STREQUAL "\t")
|
||||
endif()
|
||||
# Next we detect if there is any trailing whitespace and remove any if there is
|
||||
string(LENGTH "${TEMP_STRING}" STRING_LEN)
|
||||
math(EXPR STRING_LEN "${STRING_LEN} - 1")
|
||||
string(SUBSTRING "${TEMP_STRING}" ${STRING_LEN} 1 LAST_CHAR)
|
||||
if(LAST_CHAR STREQUAL " " OR LAST_CHAR STREQUAL "\t")
|
||||
string(REGEX REPLACE "[ \t]+$" "" ${OUTPUT_STRING} "${TEMP_STRING}")
|
||||
else(LAST_CHAR STREQUAL " " OR LAST_CHAR STREQUAL "\t")
|
||||
else()
|
||||
set(${OUTPUT_STRING} "${TEMP_STRING}")
|
||||
endif(LAST_CHAR STREQUAL " " OR LAST_CHAR STREQUAL "\t")
|
||||
endif(EMPTY_STRING)
|
||||
endif(${INPUT_STRING} STREQUAL "")
|
||||
endif(CMAKE26_OR_BETTER)
|
||||
endmacro(strip_string)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
###############################################################################
|
||||
# append_to_list(<list> <args>...)
|
||||
@@ -51,11 +51,11 @@ macro(append_to_list LIST)
|
||||
if(CMAKE242_OR_BETTER)
|
||||
# For CMake 2.4.2 or better, we can just use the APPEND sub-command of list()
|
||||
list(APPEND ${LIST} ${ARGN})
|
||||
else(CMAKE242_OR_BETTER)
|
||||
else()
|
||||
# For CMake 2.4.x before 2.4.2, we have to do this manually use set() instead
|
||||
set(${LIST} ${${LIST}} ${ARGN})
|
||||
endif(CMAKE242_OR_BETTER)
|
||||
endmacro(append_to_list)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
###############################################################################
|
||||
# find_in_list(<list> <value> <output variable>)
|
||||
@@ -69,7 +69,7 @@ macro(find_in_list LIST ITEM_TO_FIND FOUND)
|
||||
if(CMAKE248_OR_BETTER)
|
||||
# For CMake 2.4.8 or better, we can use the FIND sub-command of list()
|
||||
list(FIND ${LIST} ${ITEM_TO_FIND} ITEM_FOUND)
|
||||
else(CMAKE248_OR_BETTER)
|
||||
else()
|
||||
# For CMake 2.4.x before 2.4.8, we have to do this ourselves (NOTE: This is very slow due to a lack of break() as well)
|
||||
# Firstly we set the position to -1 indicating nothing found, we also use a temporary position
|
||||
set(ITEM_FOUND -1)
|
||||
@@ -79,14 +79,14 @@ macro(find_in_list LIST ITEM_TO_FIND FOUND)
|
||||
# If the item we are looking at is the item we are trying to find, set that we've found the item
|
||||
if(${ITEM} STREQUAL ${ITEM_TO_FIND})
|
||||
set(ITEM_FOUND ${POS})
|
||||
endif(${ITEM} STREQUAL ${ITEM_TO_FIND})
|
||||
endif()
|
||||
# Increase the position value by 1
|
||||
math(EXPR POS "${POS} + 1")
|
||||
endforeach(ITEM)
|
||||
endif(CMAKE248_OR_BETTER)
|
||||
endforeach()
|
||||
endif()
|
||||
# Set the given FOUND variable to the result
|
||||
set(${FOUND} ${ITEM_FOUND})
|
||||
endmacro(find_in_list)
|
||||
endmacro()
|
||||
|
||||
###############################################################################
|
||||
# remove_list_duplicates(<list>)
|
||||
@@ -100,7 +100,7 @@ macro(remove_list_duplicates LIST)
|
||||
if(CMAKE26_OR_BETTER)
|
||||
# For CMake 2.6.x or better, this can be done automatically
|
||||
list(REMOVE_DUPLICATES ${LIST})
|
||||
else(CMAKE26_OR_BETTER)
|
||||
else()
|
||||
# For CMake 2.4.x, we have to do this ourselves, firstly we'll clear a temporary list
|
||||
set(NEW_LIST)
|
||||
# Iterate through the old list
|
||||
@@ -110,12 +110,12 @@ macro(remove_list_duplicates LIST)
|
||||
if(FOUND_ITEM EQUAL -1)
|
||||
# If the item was not found, append it to the list
|
||||
append_to_list(NEW_LIST ${ITEM})
|
||||
endif(FOUND_ITEM EQUAL -1)
|
||||
endforeach(ITEM)
|
||||
endif()
|
||||
endforeach()
|
||||
# Replace the old list with the new list
|
||||
set(${LIST} ${NEW_LIST})
|
||||
endif(CMAKE26_OR_BETTER)
|
||||
endmacro(remove_list_duplicates)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
###############################################################################
|
||||
# remove_item_from_list(<list> <value>)
|
||||
@@ -129,7 +129,7 @@ macro(remove_item_from_list LIST VALUE)
|
||||
if(CMAKE242_OR_BETTER)
|
||||
# For CMake 2.4.2 or better, this can be done automatically
|
||||
list(REMOVE_ITEM ${LIST} ${VALUE})
|
||||
else(CMAKE242_OR_BETTER)
|
||||
else()
|
||||
# For CMake 2.4.x before 2.4.2, we have to do this ourselves, firstly we set the index and a variable to indicate if the item was found
|
||||
set(INDEX 0)
|
||||
set(FOUND FALSE)
|
||||
@@ -140,13 +140,13 @@ macro(remove_item_from_list LIST VALUE)
|
||||
if(ITEM STREQUAL ${VALUE})
|
||||
set(FOUND TRUE)
|
||||
list(REMOVE_ITEM ${LIST} ${INDEX})
|
||||
endif(ITEM STREQUAL ${VALUE})
|
||||
endif(NOT FOUND)
|
||||
endif()
|
||||
endif()
|
||||
# Increase the index value by 1
|
||||
math(EXPR INDEX "${INDEX} + 1")
|
||||
endforeach(ITEM)
|
||||
endif(CMAKE242_OR_BETTER)
|
||||
endmacro(remove_item_from_list)
|
||||
endforeach()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
###############################################################################
|
||||
# sort_list(<list>)
|
||||
@@ -159,7 +159,7 @@ macro(sort_list LIST)
|
||||
if(CMAKE244_OR_BETTER)
|
||||
# For CMake 2.4.4 or better, this can be done automatically
|
||||
list(SORT ${LIST})
|
||||
else(CMAKE244_OR_BETTER)
|
||||
else()
|
||||
# For CMake 2.4.x before 2.4.4, we have to do this ourselves, firstly we'll create a teporary list
|
||||
set(NEW_LIST)
|
||||
# Iterate through the old list
|
||||
@@ -174,20 +174,20 @@ macro(sort_list LIST)
|
||||
if(NEW_ITEM STRGREATER "${ITEM}")
|
||||
set(FOUND TRUE)
|
||||
list(INSERT NEW_LIST ${INDEX} ${ITEM})
|
||||
endif(NEW_ITEM STRGREATER "${ITEM}")
|
||||
endif(NOT FOUND)
|
||||
endif()
|
||||
endif()
|
||||
# Increase the index value by 1
|
||||
math(EXPR INDEX "${INDEX} + 1")
|
||||
endforeach(NEW_ITEM)
|
||||
endforeach()
|
||||
# If the item was never found, just append it to the end
|
||||
if(NOT FOUND)
|
||||
append_to_list(NEW_LIST ${ITEM})
|
||||
endif(NOT FOUND)
|
||||
endforeach(ITEM)
|
||||
endif()
|
||||
endforeach()
|
||||
# Replace the old list with the new list
|
||||
set(${LIST} ${NEW_LIST})
|
||||
endif(CMAKE244_OR_BETTER)
|
||||
endmacro(sort_list)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
###############################################################################
|
||||
# read_from_file(<filename> <regex> <output variable>)
|
||||
@@ -203,10 +203,10 @@ macro(read_from_file FILE REGEX STRINGS)
|
||||
# For CMake 2.6.x or better, we can just use the STRINGS sub-command to get the lines that match the given regular expression (if one is given, otherwise get all lines)
|
||||
if(REGEX STREQUAL "")
|
||||
file(STRINGS ${FILE} RESULT)
|
||||
else(REGEX STREQUAL "")
|
||||
else()
|
||||
file(STRINGS ${FILE} RESULT REGEX ${REGEX})
|
||||
endif(REGEX STREQUAL "")
|
||||
else(CMAKE26_OR_BETTER)
|
||||
endif()
|
||||
else()
|
||||
# For CMake 2.4.x, we need to do this manually, firstly we read the file in
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -DFILE:STRING=${FILE} -P ${Anope_SOURCE_DIR}/cmake/ReadFile.cmake ERROR_VARIABLE ALL_STRINGS)
|
||||
# Next we replace all newlines with semicolons
|
||||
@@ -214,7 +214,7 @@ macro(read_from_file FILE REGEX STRINGS)
|
||||
if(REGEX STREQUAL "")
|
||||
# For no regular expression, just set the result to all the lines
|
||||
set(RESULT ${ALL_STRINGS})
|
||||
else(REGEX STREQUAL "")
|
||||
else()
|
||||
# Clear the result list
|
||||
set(RESULT)
|
||||
# Iterate through all the lines of the file
|
||||
@@ -224,13 +224,13 @@ macro(read_from_file FILE REGEX STRINGS)
|
||||
# If we had a match, append the match to the list
|
||||
if(STRING_MATCH)
|
||||
append_to_list(RESULT ${STRING})
|
||||
endif(STRING_MATCH)
|
||||
endforeach(STRING)
|
||||
endif(REGEX STREQUAL "")
|
||||
endif(CMAKE26_OR_BETTER)
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
# Set the given STRINGS variable to the result
|
||||
set(${STRINGS} ${RESULT})
|
||||
endmacro(read_from_file)
|
||||
endmacro()
|
||||
|
||||
###############################################################################
|
||||
# extract_include_filename(<line> <output variable> [<optional output variable of quote type>])
|
||||
@@ -243,7 +243,7 @@ macro(extract_include_filename INCLUDE FILENAME)
|
||||
# Make sure to only do the following if there is a string
|
||||
if(INCLUDE_STRIPPED STREQUAL "")
|
||||
set(FILE "")
|
||||
else(INCLUDE_STRIPPED STREQUAL "")
|
||||
else()
|
||||
# Extract the filename including the quotes or angle brackets
|
||||
string(REGEX REPLACE "^.*([\"<].*[\">]).*$" "\\1" FILE "${INCLUDE_STRIPPED}")
|
||||
# If an optional 3rd argument is given, we'll store if the quote style was quoted or angle bracketed
|
||||
@@ -251,16 +251,16 @@ macro(extract_include_filename INCLUDE FILENAME)
|
||||
string(SUBSTRING ${FILE} 0 1 QUOTE)
|
||||
if(QUOTE STREQUAL "<")
|
||||
set(${ARGV2} "angle brackets")
|
||||
else(QUOTE STREQUAL "<")
|
||||
else()
|
||||
set(${ARGV2} "quotes")
|
||||
endif(QUOTE STREQUAL "<")
|
||||
endif(${ARGC} GREATER 2)
|
||||
endif()
|
||||
endif()
|
||||
# Now remove the quotes or angle brackets
|
||||
string(REGEX REPLACE "^[\"<](.*)[\">]$" "\\1" FILE "${FILE}")
|
||||
endif(INCLUDE_STRIPPED STREQUAL "")
|
||||
endif()
|
||||
# Set the filename to the the given variable
|
||||
set(${FILENAME} "${FILE}")
|
||||
endmacro(extract_include_filename)
|
||||
endmacro()
|
||||
|
||||
###############################################################################
|
||||
# find_includes(<source filename> <output variable>)
|
||||
@@ -293,17 +293,17 @@ macro(find_includes SRC INCLUDES)
|
||||
# Replace _WIN32 with WIN32, so we can check if the WIN32 variable of CMake is set instead of _WIN32
|
||||
if(DEFINE STREQUAL "_WIN32")
|
||||
set(DEFINE WIN32)
|
||||
endif(DEFINE STREQUAL "_WIN32")
|
||||
endif()
|
||||
# Set the last define to this one, and set the last check to true, so when #else is encountered, we can do an opposing check
|
||||
set(LAST_DEF ${DEFINE})
|
||||
set(LAST_CHECK TRUE)
|
||||
# If the define is true (it either exists or is a non-false result), the lines following will be checked, otherwise they will be skipped
|
||||
if(${DEFINE})
|
||||
set(VALID_LINE TRUE)
|
||||
else(${DEFINE})
|
||||
else()
|
||||
set(VALID_LINE FALSE)
|
||||
endif(${DEFINE})
|
||||
else(FOUND_IFDEF)
|
||||
endif()
|
||||
else()
|
||||
# If we found a #ifndef on the line, the same thing as #ifdef is done, except with the checks in the opposite direction
|
||||
if(FOUND_IFNDEF)
|
||||
# Extract the define
|
||||
@@ -311,52 +311,52 @@ macro(find_includes SRC INCLUDES)
|
||||
# Replace _WIN32 with WIN32, so we can check if the WIN32 variable of CMake is set instead of _WIN32
|
||||
if(DEFINE STREQUAL "_WIN32")
|
||||
set(DEFINE WIN32)
|
||||
endif(DEFINE STREQUAL "_WIN32")
|
||||
endif()
|
||||
# Set the last define to this one, and set the last check to false, so when #else is encountered, we can do an opposing check
|
||||
set(LAST_DEF ${DEFINE})
|
||||
set(LAST_CHECK FALSE)
|
||||
# If the define is not true (it either doesn't exists or is a false result), the lines following will be checked, otherwise they will be skipped
|
||||
if(${DEFINE})
|
||||
set(VALID_LINE FALSE)
|
||||
else(${DEFINE})
|
||||
else()
|
||||
set(VALUE_LINE TRUE)
|
||||
endif(${DEFINE})
|
||||
else(FOUND_IFNDEF)
|
||||
endif()
|
||||
else()
|
||||
# If we found a #else on the line, we check the last define in the opposite direction
|
||||
if(FOUND_ELSE)
|
||||
# When LAST_CHECK is true, we were inside a #ifdef, now act as if we are entering a #ifndef section by doing an opposing check
|
||||
if(LAST_CHECK)
|
||||
if(${LAST_DEF})
|
||||
set(VALID_LINE FALSE)
|
||||
else(${LAST_DEF})
|
||||
else()
|
||||
set(VALID_LINE TRUE)
|
||||
endif(${LAST_DEF})
|
||||
endif()
|
||||
# When LAST_CHECK is false, we were inside a #ifndef, now act as if we are entering a #ifdef section by doing an opposing check
|
||||
else(LAST_CHECK)
|
||||
else()
|
||||
if(${LAST_DEF})
|
||||
set(VALID_LINE TRUE)
|
||||
else(${LAST_DEF})
|
||||
else()
|
||||
set(VALID_LINE FALSE)
|
||||
endif(${LAST_DEF})
|
||||
endif(LAST_CHECK)
|
||||
else(FOUND_ELSE)
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
# If we found a #endif on the line, we'll assume everything following the line is valid until we meet another one of the above lines
|
||||
if(FOUND_ENDIF)
|
||||
set(VALID_LINE TRUE)
|
||||
else(FOUND_ENDIF)
|
||||
else()
|
||||
# If we found a #include on the line, add the entire line to the list of includes unless the line isn't valid
|
||||
if(FOUND_INCLUDE)
|
||||
if(VALID_LINE)
|
||||
append_to_list(INCLUDES_LIST "${LINE}")
|
||||
endif(VALID_LINE)
|
||||
endif(FOUND_INCLUDE)
|
||||
endif(FOUND_ENDIF)
|
||||
endif(FOUND_ELSE)
|
||||
endif(FOUND_IFNDEF)
|
||||
endif(FOUND_IFDEF)
|
||||
endforeach(LINE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
set(${INCLUDES} ${INCLUDES_LIST})
|
||||
endmacro(find_includes)
|
||||
endmacro()
|
||||
|
||||
###############################################################################
|
||||
# calculate_depends(<source filename> [<optional output variable for includes>])
|
||||
@@ -370,7 +370,7 @@ macro(calculate_depends SRC)
|
||||
# Check for a third argument
|
||||
if(${ARGC} GREATER 1)
|
||||
set(CHECK_ANGLE_INCLUDES TRUE)
|
||||
endif(${ARGC} GREATER 1)
|
||||
endif()
|
||||
# Find all the lines in the given source file that have any form of #include on them, regardless of whitespace, but only if they are valid for the platform we are on
|
||||
find_includes(${SRC} INCLUDES)
|
||||
# Reset the list of headers to empty
|
||||
@@ -385,9 +385,9 @@ macro(calculate_depends SRC)
|
||||
# Find the path of the include file
|
||||
if(DEFAULT_INCLUDE_DIRS OR WSDK_PATH OR DEFINED $ENV{VCINSTALLDIR})
|
||||
find_path(FOUND_${FILENAME}_INCLUDE NAMES ${FILENAME} PATHS ${DEFAULT_INCLUDE_DIRS} ${WSDK_PATH}/include $ENV{VCINSTALLDIR}/include ${EXTRA_INCLUDE})
|
||||
else(DEFAULT_INCLUDE_DIRS OR WSDK_PATH OR DEFINED $ENV{VCINSTALLDIR})
|
||||
else()
|
||||
find_path(FOUND_${FILENAME}_INCLUDE NAMES ${FILENAME} ${EXTRA_INCLUDE})
|
||||
endif(DEFAULT_INCLUDE_DIRS OR WSDK_PATH OR DEFINED $ENV{VCINSTALLDIR})
|
||||
endif()
|
||||
# If the include file was found, add it's path to the list of include paths, but only if it doesn't already exist and isn't in the defaults for the compiler
|
||||
if(FOUND_${FILENAME}_INCLUDE)
|
||||
# This used to be find_in_list, but it was changed to this loop to do a find on each default include directory, this fixes Mac OS X trying to get it's framework directories in here
|
||||
@@ -397,24 +397,24 @@ macro(calculate_depends SRC)
|
||||
string(REGEX MATCH ${DEFAULT_INCLUDE_DIR} FOUND_DEFAULT ${FOUND_${FILENAME}_INCLUDE})
|
||||
if(FOUND_DEFAULT)
|
||||
set(FOUND_IN_DEFAULTS 0)
|
||||
endif(FOUND_DEFAULT)
|
||||
endforeach(DEFAULT_INCLUDE_DIR)
|
||||
endif()
|
||||
endforeach()
|
||||
if(FOUND_IN_DEFAULTS EQUAL -1)
|
||||
find_in_list(${ARGV1} "${FOUND_${FILENAME}_INCLUDE}" FOUND_IN_INCLUDES)
|
||||
if(FOUND_IN_INCLUDES EQUAL -1)
|
||||
append_to_list(${ARGV1} "${FOUND_${FILENAME}_INCLUDE}")
|
||||
endif(FOUND_IN_INCLUDES EQUAL -1)
|
||||
endif(FOUND_IN_DEFAULTS EQUAL -1)
|
||||
else(FOUND_${FILENAME}_INCLUDE)
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
# XXX
|
||||
if(NOT ${FILENAME} STREQUAL "libintl.h")
|
||||
message(FATAL_ERROR "${SRC} needs header file ${FILENAME} but we were unable to locate that header file! Check that the header file is within the search path of your OS.")
|
||||
endif(NOT ${FILENAME} STREQUAL "libintl.h")
|
||||
endif(FOUND_${FILENAME}_INCLUDE)
|
||||
endif(CHECK_ANGLE_INCLUDES)
|
||||
endif(QUOTE_TYPE STREQUAL "angle brackets")
|
||||
endforeach(INCLUDE)
|
||||
endmacro(calculate_depends)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
###############################################################################
|
||||
# calculate_libraries(<source filename> <output variable for linker flags> <output variable for extra depends>)
|
||||
@@ -434,9 +434,9 @@ macro(calculate_libraries SRC SRC_LDFLAGS EXTRA_DEPENDS)
|
||||
# Check to see if there are any lines matching: /* RequiredLibraries: [something] */
|
||||
if(WIN32)
|
||||
read_from_file(${SRC} "/\\\\*[ \t]*RequiredWindowsLibraries:[ \t]*.*[ \t]*\\\\*/" REQUIRED_LIBRARIES)
|
||||
else(WIN32)
|
||||
else()
|
||||
read_from_file(${SRC} "/\\\\*[ \t]*RequiredLibraries:[ \t]*.*[ \t]*\\\\*/" REQUIRED_LIBRARIES)
|
||||
endif(WIN32)
|
||||
endif()
|
||||
# Iterate through those lines
|
||||
foreach(REQUIRED_LIBRARY ${REQUIRED_LIBRARIES})
|
||||
# Strip off the /* RequiredLibraries: and */ from the line
|
||||
@@ -448,10 +448,10 @@ macro(calculate_libraries SRC SRC_LDFLAGS EXTRA_DEPENDS)
|
||||
# Locate the library to see if it exists
|
||||
if(DEFAULT_LIBRARY_DIRS OR WSDK_PATH OR DEFINED $ENV{VCINSTALLDIR})
|
||||
find_library(FOUND_${LIBRARY}_LIBRARY NAMES ${LIBRARY} PATHS ${DEFAULT_LIBRARY_DIRS} ${WSDK_PATH}/lib $ENV{VCINSTALLDIR}/lib ${EXTRA_INCLUDE} ${EXTRA_LIBS})
|
||||
else(DEFAULT_LIBRARY_DIRS OR WSDK_PATH OR DEFINED $ENV{VCINSTALLDIR})
|
||||
else()
|
||||
find_library(FOUND_${LIBRARY}_LIBRARY NAMES ${LIBRARY} PATHS ${EXTRA_INCLUDE} ${EXTRA_LIBS} NO_DEFAULT_PATH)
|
||||
find_library(FOUND_${LIBRARY}_LIBRARY NAMES ${LIBRARY} PATHS ${EXTRA_INCLUDE} ${EXTRA_LIBS})
|
||||
endif(DEFAULT_LIBRARY_DIRS OR WSDK_PATH OR DEFINED $ENV{VCINSTALLDIR})
|
||||
endif()
|
||||
# If the library was found, we will add it to the linker flags
|
||||
if(FOUND_${LIBRARY}_LIBRARY)
|
||||
# Get the path only of the library, to add it to linker flags
|
||||
@@ -459,39 +459,39 @@ macro(calculate_libraries SRC SRC_LDFLAGS EXTRA_DEPENDS)
|
||||
if(MSVC)
|
||||
# For Visual Studio, instead of editing the linker flags, we'll add the library to a separate list of extra dependencies
|
||||
append_to_list(EXTRA_DEPENDENCIES "${FOUND_${LIBRARY}_LIBRARY}")
|
||||
else(MSVC)
|
||||
else()
|
||||
# For all others, add the library paths and libraries
|
||||
append_to_list(LIBRARY_PATHS "${LIBRARY_PATH}")
|
||||
append_to_list(LIBRARIES "${LIBRARY}")
|
||||
endif(MSVC)
|
||||
else(FOUND_${LIBRARY}_LIBRARY)
|
||||
endif()
|
||||
else()
|
||||
# In the case of the library not being found, we fatally error so CMake stops trying to generate
|
||||
message(FATAL_ERROR "${SRC} needs library ${LIBRARY} but we were unable to locate that library! Check that the library is within the search path of your OS.")
|
||||
endif(FOUND_${LIBRARY}_LIBRARY)
|
||||
endforeach(LIBRARY)
|
||||
endforeach(REQUIRED_LIBRARY)
|
||||
endif()
|
||||
endforeach()
|
||||
endforeach()
|
||||
# Remove duplicates from the library paths
|
||||
if(LIBRARY_PATHS)
|
||||
remove_list_duplicates(LIBRARY_PATHS)
|
||||
endif(LIBRARY_PATHS)
|
||||
endif()
|
||||
# Remove diplicates from the libraries
|
||||
if(LIBRARIES)
|
||||
remove_list_duplicates(LIBRARIES)
|
||||
endif(LIBRARIES)
|
||||
endif()
|
||||
# Iterate through library paths and add them to the linker flags
|
||||
foreach(LIBRARY_PATH ${LIBRARY_PATHS})
|
||||
find_in_list(DEFAULT_LIBRARY_DIRS "${LIBRARY_PATH}" FOUND_IN_DEFAULTS)
|
||||
if(FOUND_IN_DEFAULTS EQUAL -1)
|
||||
set(THIS_LDFLAGS "${THIS_LDFLAGS} -L${LIBRARY_PATH}")
|
||||
endif(FOUND_IN_DEFAULTS EQUAL -1)
|
||||
endforeach(LIBRARY_PATH)
|
||||
endif()
|
||||
endforeach()
|
||||
# Iterate through libraries and add them to the linker flags
|
||||
foreach(LIBRARY ${LIBRARIES})
|
||||
append_to_list(EXTRA_DEPENDENCIES "${LIBRARY}")
|
||||
endforeach(LIBRARY)
|
||||
endforeach()
|
||||
set(${SRC_LDFLAGS} "${THIS_LDFLAGS}")
|
||||
set(${EXTRA_DEPENDS} "${EXTRA_DEPENDENCIES}")
|
||||
endmacro(calculate_libraries)
|
||||
endmacro()
|
||||
|
||||
###############################################################################
|
||||
# check_functions(<source filename> <output variable set to TRUE on success>)
|
||||
@@ -518,10 +518,10 @@ macro(check_functions SRC SUCCESS)
|
||||
if(NOT HAVE_${REQUIRED_FUNCTION})
|
||||
message("${SRC} needs function ${REQUIRED_FUNCTION} but we were unable to locate that function!")
|
||||
set(${SUCCESS} FALSE)
|
||||
endif(NOT HAVE_${REQUIRED_FUNCTION})
|
||||
endforeach(FUNCTION)
|
||||
endforeach(REQUIRED_FUNCTION)
|
||||
endmacro(check_functions)
|
||||
endif()
|
||||
endforeach()
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
###############################################################################
|
||||
# add_to_cpack_ignored_files(<item> [TRUE])
|
||||
@@ -536,12 +536,12 @@ macro(add_to_cpack_ignored_files ITEM)
|
||||
# If we have 2+ arguments, assume that the second one was something like TRUE (doesn't matter really) and convert periods so they will be \\. for CPack
|
||||
if(${ARGC} GREATER 1)
|
||||
string(REPLACE "." "\\\\." REAL_ITEM ${REAL_ITEM})
|
||||
endif(${ARGC} GREATER 1)
|
||||
endif()
|
||||
# If the environment variable is already defined, just tack the item to the end
|
||||
if(DEFINED ENV{CPACK_IGNORED_FILES})
|
||||
set(ENV{CPACK_IGNORED_FILES} "$ENV{CPACK_IGNORED_FILES};${REAL_ITEM}")
|
||||
# Otherwise set the environment variable to the item
|
||||
else(DEFINED ENV{CPACK_IGNORED_FILES})
|
||||
else()
|
||||
set(ENV{CPACK_IGNORED_FILES} "${REAL_ITEM}")
|
||||
endif(DEFINED ENV{CPACK_IGNORED_FILES})
|
||||
endmacro(add_to_cpack_ignored_files)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
@@ -7,20 +7,20 @@ if(NOT WIN32)
|
||||
set(GETTEXT_FOUND TRUE)
|
||||
if(GETTEXT_LIBRARY)
|
||||
set(GETTEXT_LIBRARIES ${GETTEXT_LIBRARY})
|
||||
endif(GETTEXT_LIBRARY)
|
||||
endif(GETTEXT_INCLUDE AND GETTEXT_MSGFMT)
|
||||
else(NOT WIN32)
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
find_path(GETTEXT_INCLUDE libintl.h ${DEFAULT_INCLUDE_DIRS} ${WSDK_PATH}/include $ENV{VCINSTALLDIR}/include gettext/include ${EXTRA_INCLUDE})
|
||||
find_library(GETTEXT_LIBRARY libintl PATHS ${DEFAULT_LIBRARY_DIRS} ${WSDK_PATH}/lib $ENV{VCINSTALLDIR}/lib gettext/lib ${EXTRA_LIBS})
|
||||
find_program(GETTEXT_MSGFMT msgfmt PATHS ${DEFAULT_INCLUDE_DIRS} ${WSDK_PATH}/bin $ENV{VCINSTALLDIR}/bin gettext/bin ${EXTRA_INCLUDE})
|
||||
if(GETTEXT_INCLUDE AND GETTEXT_LIBRARY AND GETTEXT_MSGFMT)
|
||||
set(GETTEXT_FOUND TRUE)
|
||||
set(GETTEXT_LIBRARIES ${GETTEXT_LIBRARY})
|
||||
endif(GETTEXT_INCLUDE AND GETTEXT_LIBRARY AND GETTEXT_MSGFMT)
|
||||
endif(NOT WIN32)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# If we found everything we need set variables correctly for lang/CMakeLists.txt to use
|
||||
if(GETTEXT_FOUND)
|
||||
include_directories("${GETTEXT_INCLUDE}")
|
||||
set(GETTEXT_MSGFMT_EXECUTABLE ${GETTEXT_MSGFMT})
|
||||
endif(GETTEXT_FOUND)
|
||||
endif()
|
||||
|
||||
+2
-2
@@ -6,10 +6,10 @@ if(WIN32)
|
||||
if(IN_SOURCE)
|
||||
# Add README.txt to list of files for CPack to ignore
|
||||
add_to_cpack_ignored_files("README.txt$" TRUE)
|
||||
endif(IN_SOURCE)
|
||||
endif()
|
||||
set(DOCS Changes Changes.conf DEFCON FAQ INSTALL LANGUAGE MODULES NEWS ${CMAKE_CURRENT_BINARY_DIR}/README.txt WIN32.txt)
|
||||
install(FILES ${DOCS}
|
||||
DESTINATION ${DOC_DIR}
|
||||
)
|
||||
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_CURRENT_BINARY_DIR}/README.txt")
|
||||
endif(WIN32)
|
||||
endif()
|
||||
|
||||
@@ -16,7 +16,7 @@ add_to_cpack_ignored_files("${version_BINARY}$" TRUE)
|
||||
if(NOT WIN32)
|
||||
add_to_cpack_ignored_files("version.h$" TRUE)
|
||||
add_to_cpack_ignored_files("build.h$" TRUE)
|
||||
endif(NOT WIN32)
|
||||
endif()
|
||||
|
||||
set(PCH_SOURCES_GCH "")
|
||||
if(USE_PCH AND CMAKE_COMPILER_IS_GNUCXX)
|
||||
@@ -36,20 +36,20 @@ if(USE_PCH AND CMAKE_COMPILER_IS_GNUCXX)
|
||||
find_in_list(PCH_SOURCES "${FILENAME}" FOUND)
|
||||
if(NOT FOUND EQUAL -1)
|
||||
append_to_list(INCLUDES_LIST ${FILENAME})
|
||||
endif(NOT FOUND EQUAL -1)
|
||||
endif(QUOTE_TYPE STREQUAL "quotes")
|
||||
endforeach(INCLUDE)
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
set(PCH_EXTRAFLAGS "")
|
||||
if(DEBUG_BUILD)
|
||||
set(PCH_EXTRAFLAGS "-g")
|
||||
endif(DEBUG_BUILD)
|
||||
endif()
|
||||
if(PCH_SOURCE STREQUAL "module.h")
|
||||
set(PCH_EXTRAFLAGS ${PCH_EXTRAFLAGS} -fPIC)
|
||||
endif(PCH_SOURCE STREQUAL "module.h")
|
||||
endif()
|
||||
if(GETTEXT_INCLUDE)
|
||||
set(PCH_GETTEXT_INCLUDE "-I${GETTEXT_INCLUDE}")
|
||||
endif(GETTEXT_INCLUDE)
|
||||
endif()
|
||||
|
||||
set(PCH_SOURCES_GCH "${PCH_SOURCES_GCH};${CMAKE_CURRENT_BINARY_DIR}/${PCH_SOURCE}.gch")
|
||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${PCH_SOURCE}.gch
|
||||
@@ -57,8 +57,8 @@ if(USE_PCH AND CMAKE_COMPILER_IS_GNUCXX)
|
||||
${PCH_GETTEXT_INCLUDE} -I${CMAKE_CURRENT_BINARY_DIR} -I${Anope_SOURCE_DIR}/modules/pseudoclients ${CMAKE_CURRENT_SOURCE_DIR}/${PCH_SOURCE} -o ${CMAKE_CURRENT_BINARY_DIR}/${PCH_SOURCE}.gch
|
||||
DEPENDS ${INCLUDES_LIST} VERBATIM
|
||||
)
|
||||
endforeach(PCH_SOURCE ${PCH_SOURCES})
|
||||
endif(USE_PCH AND CMAKE_COMPILER_IS_GNUCXX)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
# Add a custom target to the above file
|
||||
add_custom_target(headers DEPENDS version-bin ${CMAKE_CURRENT_BINARY_DIR}/version_build ${PCH_SOURCES_GCH})
|
||||
|
||||
@@ -26,12 +26,12 @@ if(GETTEXT_FOUND)
|
||||
# Add to cpack ignored files if not on Windows.
|
||||
if(NOT WIN32)
|
||||
add_to_cpack_ignored_files("${LANG_MO}")
|
||||
endif(NOT WIN32)
|
||||
endif()
|
||||
|
||||
# Install the new language file
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${LANG_MO} DESTINATION ${LOCALE_DIR}/${LANG_LANG}/LC_MESSAGES RENAME ${LANG_DOMAIN}.mo PERMISSIONS ${PERMS})
|
||||
endforeach(LANG_PO)
|
||||
endforeach()
|
||||
|
||||
# Generate languages, depends on the mo files
|
||||
add_custom_target(language DEPENDS ${LANG_SRCS_MO})
|
||||
endif(GETTEXT_FOUND)
|
||||
endif()
|
||||
|
||||
+33
-33
@@ -1,21 +1,21 @@
|
||||
# If using Windows, add the MODULE_COMPILE define
|
||||
if(WIN32)
|
||||
add_definitions(-DMODULE_COMPILE)
|
||||
endif(WIN32)
|
||||
endif()
|
||||
|
||||
macro(build_modules SRC)
|
||||
if(NOT ${SRC} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR} AND EXISTS "${SRC}/CMakeLists.txt")
|
||||
add_subdirectory("${SRC}")
|
||||
else(NOT ${SRC} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR} AND EXISTS "${SRC}/CMakeLists.txt")
|
||||
else()
|
||||
file(GLOB MODULES_SRCS "${SRC}/*")
|
||||
foreach(MODULE_SRC ${MODULES_SRCS})
|
||||
if(IS_DIRECTORY "${MODULE_SRC}")
|
||||
build_modules("${MODULE_SRC}")
|
||||
else(IS_DIRECTORY "${MODULE_SRC}")
|
||||
else()
|
||||
string(REGEX MATCH "\\.c$" ANOPE18MODULE ${MODULE_SRC})
|
||||
if(ANOPE18MODULE)
|
||||
message(FATAL_ERROR "Anope 1 modules are not compatible with Anope 2!\nOffending module: ${MODULE_SRC}")
|
||||
endif(ANOPE18MODULE)
|
||||
endif()
|
||||
string(REGEX MATCH "\\.cpp$" CPP ${MODULE_SRC})
|
||||
if(CPP)
|
||||
set_source_files_properties(${MODULE_SRC} PROPERTIES LANGUAGE CXX COMPILE_FLAGS "${CXXFLAGS}")
|
||||
@@ -30,7 +30,7 @@ macro(build_modules SRC)
|
||||
# If there were some extra include directories, add them to the list
|
||||
if(TEMP_INCLUDES)
|
||||
append_to_list(EXTRA_INCLUDES ${TEMP_INCLUDES})
|
||||
endif(TEMP_INCLUDES)
|
||||
endif()
|
||||
|
||||
# Reset linker flags
|
||||
set(TEMP_LDFLAGS)
|
||||
@@ -47,40 +47,40 @@ macro(build_modules SRC)
|
||||
# For Visual Studio only, include win32_memory static library, required to override Visual Studio's overrides of the new/delete operators
|
||||
if(MSVC)
|
||||
set(WIN32_MEMORY win32_memory)
|
||||
else(MSVC)
|
||||
else()
|
||||
set(WIN32_MEMORY)
|
||||
endif(MSVC)
|
||||
endif()
|
||||
# Generate the module and set its linker flags, also set it to depend on the main Anope executable to be built beforehand
|
||||
add_library(${SO} MODULE ${MODULE_SRC})
|
||||
# Windows requires this because it's weird
|
||||
if(WIN32)
|
||||
set(WIN32_NO_LIBS "/nodefaultlib:\"libcmt.lib\" /OPT:NOREF")
|
||||
else(WIN32)
|
||||
else()
|
||||
set(WIN32_NO_LIBS)
|
||||
endif(WIN32)
|
||||
endif()
|
||||
set_target_properties(${SO} PROPERTIES LINKER_LANGUAGE CXX PREFIX "" SUFFIX "" LINK_FLAGS "${TEMP_LDFLAGS} ${WIN32_NO_LIBS}" INSTALL_RPATH_USE_LINK_PATH ON BUILD_WITH_INSTALL_RPATH ON)
|
||||
add_dependencies(${SO} ${PROGRAM_NAME})
|
||||
if(GETTEXT_FOUND)
|
||||
add_dependencies(${SO} module_language)
|
||||
endif(GETTEXT_FOUND)
|
||||
endif()
|
||||
target_link_libraries(${SO} ${TEMP_DEPENDENCIES})
|
||||
# For Windows only, have the module link to the export library of Anope as well as wsock32 and Ws2_32 libraries (most of the modules probably don't need this, but this is to be on the safe side), also set its version
|
||||
if(WIN32)
|
||||
target_link_libraries(${SO} ${PROGRAM_NAME} wsock32 Ws2_32 ${WIN32_MEMORY})
|
||||
set_target_properties(${PROGRAM_NAME} PROPERTIES VERSION "${VERSION_DOTTED}")
|
||||
else(WIN32)
|
||||
else()
|
||||
if(APPLE)
|
||||
target_link_libraries(${SO} ${PROGRAM_NAME})
|
||||
endif(APPLE)
|
||||
endif(WIN32)
|
||||
endif()
|
||||
endif()
|
||||
# Set the module to be installed to the module directory under the data directory
|
||||
install(TARGETS ${SO} DESTINATION ${LIB_DIR}/modules)
|
||||
endif(HAS_FUNCTION)
|
||||
endif(CPP)
|
||||
endif(IS_DIRECTORY "${MODULE_SRC}")
|
||||
endforeach(MODULE_SRC ${MODULES_SRCS})
|
||||
endif(NOT ${SRC} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR} AND EXISTS "${SRC}/CMakeLists.txt")
|
||||
endmacro(build_modules)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(build_subdir)
|
||||
file(GLOB_RECURSE MODULES_SUBDIR_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cpp")
|
||||
@@ -104,7 +104,7 @@ macro(build_subdir)
|
||||
# If there were some extra include directories, add them to the list
|
||||
if(TEMP_INCLUDES)
|
||||
include_directories(${TEMP_INCLUDES})
|
||||
endif(TEMP_INCLUDES)
|
||||
endif()
|
||||
|
||||
# Reset linker flags
|
||||
set(TEMP_LDFLAGS)
|
||||
@@ -118,28 +118,28 @@ macro(build_subdir)
|
||||
# Append this source file's linker flags to the subdirectoy's linker flags, if there are any to append
|
||||
if(TEMP_DEPENDENCIES)
|
||||
append_to_list(SUBDIR_EXTRA_DEPENDS ${TEMP_DEPDENCIES})
|
||||
endif(TEMP_DEPENDENCIES)
|
||||
endif(HAS_FUNCTION)
|
||||
endforeach(SRC ${MODULES_SUBDIR_SRCS})
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Continue if library and function requirements are met
|
||||
if(HAS_FUNCTION)
|
||||
# Remove duplicates from the linker flags
|
||||
if(SUBDIR_LDFLAGS)
|
||||
remove_list_duplicates(SUBDIR_LDFLAGS)
|
||||
endif(SUBDIR_LDFLAGS)
|
||||
endif()
|
||||
|
||||
# Remove duplicates from the extra dependencies
|
||||
if(SUBDIR_EXTRA_DEPENDS)
|
||||
remove_list_duplicates(SUBDIR_EXTRA_DEPENDS)
|
||||
endif(SUBDIR_EXTRA_DEPENDS)
|
||||
endif()
|
||||
|
||||
# For Visual Studio only, include win32_memory static library, required to override Visual Studio's overrides of the new/delete operators
|
||||
if(MSVC)
|
||||
set(WIN32_MEMORY win32_memory)
|
||||
else(MSVC)
|
||||
else()
|
||||
set(WIN32_MEMORY)
|
||||
endif(MSVC)
|
||||
endif()
|
||||
|
||||
# Generate the module and set it's linker flags, also set it to depend on the main Anope executable to be built beforehand
|
||||
add_library(${SO} MODULE ${MODULES_SUBDIR_SRCS})
|
||||
@@ -147,23 +147,23 @@ macro(build_subdir)
|
||||
add_dependencies(${SO} ${PROGRAM_NAME})
|
||||
if(GETTEXT_FOUND)
|
||||
add_dependencies(${SO} module_language)
|
||||
endif(GETTEXT_FOUND)
|
||||
endif()
|
||||
target_link_libraries(${SO} ${SUBDIR_EXTRA_DEPENDS})
|
||||
# For Windows only, have the module link to the export library of Anope as well as wsock32 and Ws2_32 libraries (most of the modules probably don't need this, but this is to be on the safe side), also set it's version
|
||||
if(WIN32)
|
||||
target_link_libraries(${SO} ${PROGRAM_NAME} wsock32 Ws2_32 ${WIN32_MEMORY})
|
||||
set_target_properties(${PROGRAM_NAME} PROPERTIES VERSION "${VERSION_DOTTED}")
|
||||
else(WIN32)
|
||||
else()
|
||||
if(APPLE)
|
||||
target_link_libraries(${SO} ${PROGRAM_NAME})
|
||||
endif(APPLE)
|
||||
endif(WIN32)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Set the module to be installed to the module directory under the data directory
|
||||
install(TARGETS ${SO} DESTINATION ${LIB_DIR}/modules)
|
||||
|
||||
endif(HAS_FUNCTION)
|
||||
endmacro(build_subdir)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
build_modules(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
@@ -26,13 +26,13 @@ if(GETTEXT_FOUND)
|
||||
# Add to cpack ignored files if not on Windows.
|
||||
if(NOT WIN32)
|
||||
add_to_cpack_ignored_files("${LANG_MO}")
|
||||
endif(NOT WIN32)
|
||||
endif()
|
||||
|
||||
# Install the new language file
|
||||
install(CODE "FILE(MAKE_DIRECTORY ${LOCALE_DIR}/${LANG_LANG}/LC_MESSAGES/)")
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${LANG_MO} DESTINATION ${LOCALE_DIR}/${LANG_LANG}/LC_MESSAGES RENAME ${LANG_DOMAIN}.mo PERMISSIONS ${PERMS})
|
||||
endforeach(LANG_PO)
|
||||
endforeach()
|
||||
|
||||
# Generate languages, depends on the mo files
|
||||
add_custom_target(module_language DEPENDS ${LANG_SRCS_MO})
|
||||
endif(GETTEXT_FOUND)
|
||||
endif()
|
||||
|
||||
+20
-20
@@ -9,21 +9,21 @@ if(WIN32)
|
||||
append_to_list(SRC_SRCS win32/pipe/pipe.cpp)
|
||||
append_to_list(SRC_SRCS win32/pthread/pthread.cpp)
|
||||
append_to_list(SRC_SRCS win32/sigaction/sigaction.cpp)
|
||||
endif(WIN32)
|
||||
endif()
|
||||
|
||||
if(HAVE_EPOLL)
|
||||
append_to_list(SRC_SRCS socketengines/socketengine_epoll.cpp)
|
||||
else(HAVE_EPOLL)
|
||||
else()
|
||||
if(HAVE_KQUEUE)
|
||||
append_to_list(SRC_SRCS socketengines/socketengine_kqueue.cpp)
|
||||
else(HAVE_KQUEUE)
|
||||
else()
|
||||
if(HAVE_POLL)
|
||||
append_to_list(SRC_SRCS socketengines/socketengine_poll.cpp)
|
||||
else(HAVE_POLL)
|
||||
else()
|
||||
append_to_list(SRC_SRCS socketengines/socketengine_select.cpp)
|
||||
endif(HAVE_POLL)
|
||||
endif(HAVE_KQUEUE)
|
||||
endif(HAVE_EPOLL)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
sort_list(SRC_SRCS)
|
||||
|
||||
@@ -41,13 +41,13 @@ foreach(SRC ${SRC_SRCS})
|
||||
# If there were some extra include directories, add them to the list
|
||||
if(TEMP_INCLUDES)
|
||||
append_to_list(EXTRA_INCLUDES ${TEMP_INCLUDES})
|
||||
endif(TEMP_INCLUDES)
|
||||
endforeach(SRC)
|
||||
endif()
|
||||
endforeach()
|
||||
# If there were extra include directories, remove the duplicates and add the directories to the include path
|
||||
if(EXTRA_INCLUDES)
|
||||
remove_list_duplicates(EXTRA_INCLUDES)
|
||||
include_directories(${EXTRA_INCLUDES})
|
||||
endif(EXTRA_INCLUDES)
|
||||
endif()
|
||||
|
||||
# Under Windows, we also include a resource file to the build
|
||||
if(WIN32)
|
||||
@@ -61,13 +61,13 @@ if(WIN32)
|
||||
# If any sort of debugging is being enabled, add a _DEBUG define to the flags for the resource compiler
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "DEBUG" OR CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINFO")
|
||||
set(RC_CFLAGS "${RC_CFLAGS} -D_DEBUG")
|
||||
endif(CMAKE_BUILD_TYPE STREQUAL "DEBUG" OR CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINFO")
|
||||
endif()
|
||||
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/win32/win32.rc COMPILE_FLAGS "${RC_CFLAGS}")
|
||||
# For anything else, assumingly Visual Studio at this point, use a different set of compile flags
|
||||
else(MINGW)
|
||||
else()
|
||||
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/win32/win32.rc COMPILE_FLAGS "/i\"${Anope_SOURCE_DIR}/include\"")
|
||||
endif(MINGW)
|
||||
endif(WIN32)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# If compiling with Visual Studio, create a static library out of win32/win32_memory.cpp to be included with everything else, needed to override its override of new/delete operators
|
||||
if(MSVC)
|
||||
@@ -75,9 +75,9 @@ if(MSVC)
|
||||
add_library(win32_memory STATIC win32/win32_memory.cpp)
|
||||
set(WIN32_MEMORY win32_memory)
|
||||
set(EXTRA_LDFLAGS "/OPT:NOREF") # https://sourceware.org/bugzilla/show_bug.cgi?id=12633
|
||||
else(MSVC)
|
||||
else()
|
||||
set(WIN32_MEMORY)
|
||||
endif(MSVC)
|
||||
endif()
|
||||
|
||||
# Generate the Anope executable and set it's linker flags, also set it to export it's symbols even though it's not a module
|
||||
add_executable(${PROGRAM_NAME} ${SRC_SRCS})
|
||||
@@ -86,15 +86,15 @@ set_target_properties(${PROGRAM_NAME} PROPERTIES LINKER_LANGUAGE CXX LINK_FLAGS
|
||||
if(WIN32)
|
||||
target_link_libraries(${PROGRAM_NAME} wsock32 Ws2_32 ${LINK_LIBS} ${GETTEXT_LIBRARIES} ${WIN32_MEMORY})
|
||||
set_target_properties(${PROGRAM_NAME} PROPERTIES VERSION "${VERSION_DOTTED}")
|
||||
else(WIN32)
|
||||
else()
|
||||
target_link_libraries(${PROGRAM_NAME} ${LINK_LIBS} ${GETTEXT_LIBRARIES})
|
||||
endif(WIN32)
|
||||
endif()
|
||||
# Building the Anope executable requires the version.h header to be generated
|
||||
add_dependencies(${PROGRAM_NAME} headers)
|
||||
# Also require the language files if we have gettext
|
||||
if(GETTEXT_FOUND)
|
||||
add_dependencies(${PROGRAM_NAME} language)
|
||||
endif(GETTEXT_FOUND)
|
||||
endif()
|
||||
|
||||
# Get the filename of the Anope executable as it is in on this system
|
||||
get_target_property(SERVICES_BINARY ${PROGRAM_NAME} LOCATION)
|
||||
@@ -108,7 +108,7 @@ configure_file(${Anope_SOURCE_DIR}/include/sysconf.h.cmake ${Anope_BINARY_DIR}/i
|
||||
# Go into the following directories and run their CMakeLists.txt as well
|
||||
if(NOT DISABLE_TOOLS)
|
||||
add_subdirectory(tools)
|
||||
endif(NOT DISABLE_TOOLS)
|
||||
endif()
|
||||
|
||||
# Set Anope to be installed to the bin directory
|
||||
install(TARGETS ${PROGRAM_NAME}
|
||||
|
||||
@@ -20,10 +20,10 @@ foreach(SRC ${TOOLS_SRCS})
|
||||
# Only for Windows, set anopesmtp to require the wsock32 library
|
||||
if(WIN32 AND ${EXE} STREQUAL anopesmtp)
|
||||
target_link_libraries(${EXE} wsock32)
|
||||
endif(WIN32 AND ${EXE} STREQUAL anopesmtp)
|
||||
endif()
|
||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "SunOS" AND ${EXE} STREQUAL anopesmtp)
|
||||
target_link_libraries(${EXE} socket nsl)
|
||||
endif(${CMAKE_SYSTEM_NAME} STREQUAL "SunOS" AND ${EXE} STREQUAL anopesmtp)
|
||||
endif()
|
||||
# Set the executable to be installed to the bin directory under the main directory
|
||||
install(TARGETS ${EXE}
|
||||
DESTINATION ${BIN_DIR}
|
||||
@@ -32,8 +32,8 @@ foreach(SRC ${TOOLS_SRCS})
|
||||
get_target_property(EXE_BINARY ${EXE} LOCATION)
|
||||
get_filename_component(EXE_BINARY ${EXE_BINARY} NAME)
|
||||
add_to_cpack_ignored_files("${EXE_BINARY}$" TRUE)
|
||||
endif(NOT SKIP)
|
||||
endforeach(SRC)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# If not on Windows, generate anoperc and install it along with mydbgen
|
||||
if(NOT WIN32)
|
||||
@@ -44,9 +44,9 @@ if(NOT WIN32)
|
||||
install (PROGRAMS geoipupdate.sh
|
||||
DESTINATION ${BIN_DIR}
|
||||
)
|
||||
endif(NOT WIN32)
|
||||
endif()
|
||||
|
||||
# On non-Windows platforms, if RUNGROUP is set, change the permissions of the tools directory
|
||||
if(NOT WIN32 AND RUNGROUP)
|
||||
install(CODE "execute_process(COMMAND ${CHMOD} 2770 \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/bin\")")
|
||||
endif(NOT WIN32 AND RUNGROUP)
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user