mirror of
https://github.com/anope/anope.git
synced 2026-06-12 19:14:47 +02:00
Minor CMake cleanup, moving include directories and defines to use include_directories and add_definitions instead.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1865 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
+15
-11
@@ -63,34 +63,38 @@ endif(CMAKE244_OR_BETTER)
|
||||
# Add an optional variable for using run-cc.pl for building, Perl will be checked later regardless of this setting
|
||||
option(USE_RUN_CC_PL "Use run-cc.pl for building" OFF)
|
||||
|
||||
# Use the following directories as includes
|
||||
include_directories(${Anope_SOURCE_DIR}/include ${Anope_BINARY_DIR}/include ${Anope_BINARY_DIR}/lang)
|
||||
|
||||
# If using Windows, always add the _WIN32 define
|
||||
if(WIN32)
|
||||
add_definitions(-D_WIN32)
|
||||
endif(WIN32)
|
||||
|
||||
# If using Visual Studio, set the C++ flags accordingly
|
||||
if(MSVC)
|
||||
# Remove the default exception handling flags, also remove default warning level flag
|
||||
string(REPLACE "/EHsc " "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
||||
string(REPLACE "/GX " "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
||||
string(REPLACE "/W3 " "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
||||
# Set the compile flags to have warnings on the max setting (but disable a few annoying ones), exception handling turned on, the proper defines, and the include directories
|
||||
set(CXXFLAGS "${CXXFLAGS} /W4 /wd4251 /wd4706 /wd4800 /wd4996 /EHs /D_WIN32 /DMSVCPP /D_CRT_SECURE_NO_WARNINGS /I\"${Anope_SOURCE_DIR}/include\" /I\"${Anope_BINARY_DIR}/include\" /I\"${Anope_BINARY_DIR}/lang\"")
|
||||
# Set the module-specific compile flags to include a define for module compiling
|
||||
set(MODULE_CXXFLAGS "${CXXFLAGS} /DMODULE_COMPILE")
|
||||
# Set the compile flags to have warnings on the max setting (but disable a few annoying ones), exception handling turned on, the proper defines
|
||||
set(CXXFLAGS "${CXXFLAGS} /W4 /wd4251 /wd4706 /wd4800 /wd4996 /EHs")
|
||||
add_definitions(-DMSVCPP -D_CRT_SECURE_NO_WARNINGS)
|
||||
# Otherwise, we're not using Visual Studio
|
||||
else(MSVC)
|
||||
# Set the compile flags to have all warnings on (including shadowed variables) and the include directories
|
||||
set(CXXFLAGS "${CXXFLAGS} -Wall -Wshadow -I${Anope_SOURCE_DIR}/include -I${Anope_BINARY_DIR}/include -I${Anope_BINARY_DIR}/lang")
|
||||
# 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
|
||||
if(UNIX)
|
||||
set(CXXFLAGS "${CXXFLAGS} -ansi -pedantic -fno-leading-underscore")
|
||||
# Set the module-specific compile flags to the same setting as the compile flags
|
||||
set(MODULE_CXXFLAGS "${CXXFLAGS}")
|
||||
# If we aren't on a *nix system, set the compile flags to include a define for Windows
|
||||
# If we aren't on a *nix system, we are using MinGW
|
||||
else(UNIX)
|
||||
set(CXXFLAGS "${CXXFLAGS} -D_WIN32")
|
||||
# Also, if we are building under MinGW, add another define for MinGW
|
||||
if(MINGW)
|
||||
set(CXXFLAGS "${CXXFLAGS} -DMINGW")
|
||||
add_definitions(-DMINGW)
|
||||
endif(MINGW)
|
||||
# Set the module-specific compile flags to include a define for module compiling
|
||||
set(MODULE_CXXFLAGS "${CXXFLAGS} -DMODULE_COMPILE")
|
||||
endif(UNIX)
|
||||
endif(MSVC)
|
||||
|
||||
|
||||
@@ -6,8 +6,13 @@ if(CMAKE244_OR_BETTER)
|
||||
list(SORT CORE_SRCS)
|
||||
endif(CMAKE244_OR_BETTER)
|
||||
|
||||
# If using Windows, add the MODULE_COMPILE define
|
||||
if(WIN32)
|
||||
add_definitions(-DMODULE_COMPILE)
|
||||
endif(WIN32)
|
||||
|
||||
# Set all the files to use C++ as well as set their compile flags (use the module-specific compile flags, though)
|
||||
set_source_files_properties(${CORE_SRCS} PROPERTIES LANGUAGE CXX COMPILE_FLAGS "${MODULE_CXXFLAGS}")
|
||||
set_source_files_properties(${CORE_SRCS} PROPERTIES LANGUAGE CXX COMPILE_FLAGS "${CXXFLAGS}")
|
||||
|
||||
# Iterate through all the source files
|
||||
foreach(SRC ${CORE_SRCS})
|
||||
@@ -18,7 +23,7 @@ foreach(SRC ${CORE_SRCS})
|
||||
# For Visual Studio only, include win32_memory.cpp to the list of sources, required to override Visual Studio's overrides of the new/delete operators
|
||||
if(MSVC)
|
||||
append_to_list(SRC ${Anope_SOURCE_DIR}/src/win32_memory.cpp)
|
||||
set_source_files_properties(${Anope_SOURCE_DIR}/src/win32_memory.cpp LANGUAGE CXX COMPILE_FLAGS "${MODULE_CXXFLAGS}")
|
||||
set_source_files_properties(${Anope_SOURCE_DIR}/src/win32_memory.cpp LANGUAGE CXX COMPILE_FLAGS "${CXXFLAGS}")
|
||||
endif(MSVC)
|
||||
# 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 ${SRC})
|
||||
|
||||
@@ -6,8 +6,13 @@ if(CMAKE244_OR_BETTER)
|
||||
list(SORT MODULES_SRCS)
|
||||
endif(CMAKE244_OR_BETTER)
|
||||
|
||||
# If using Windows, add the MODULE_COMPILE define
|
||||
if(WIN32)
|
||||
add_definitions(-DMODULE_COMPILE)
|
||||
endif(WIN32)
|
||||
|
||||
# Set all the files to use C++ as well as set their compile flags (use the module-specific compile flags, though)
|
||||
set_source_files_properties(${MODULES_SRCS} PROPERTIES LANGUAGE CXX COMPILE_FLAGS "${MODULE_CXXFLAGS}")
|
||||
set_source_files_properties(${MODULES_SRCS} PROPERTIES LANGUAGE CXX COMPILE_FLAGS "${CXXFLAGS}")
|
||||
|
||||
# Iterate through all the source files
|
||||
foreach(SRC ${MODULES_SRCS})
|
||||
@@ -18,7 +23,7 @@ foreach(SRC ${MODULES_SRCS})
|
||||
# For Visual Studio only, include win32_memory.cpp to the list of sources, required to override Visual Studio's overrides of the new/delete operators
|
||||
if(MSVC)
|
||||
append_to_list(SRC ${Anope_SOURCE_DIR}/src/win32_memory.cpp)
|
||||
set_source_files_properties(${Anope_SOURCE_DIR}/src/win32_memory.cpp LANGUAGE CXX COMPILE_FLAGS "${MODULE_CXXFLAGS}")
|
||||
set_source_files_properties(${Anope_SOURCE_DIR}/src/win32_memory.cpp LANGUAGE CXX COMPILE_FLAGS "${CXXFLAGS}")
|
||||
endif(MSVC)
|
||||
# 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 ${SRC})
|
||||
|
||||
@@ -6,8 +6,13 @@ if(CMAKE244_OR_BETTER)
|
||||
list(SORT PROTOCOL_SRCS)
|
||||
endif(CMAKE244_OR_BETTER)
|
||||
|
||||
# If using Windows, add the MODULE_COMPILE define
|
||||
if(WIN32)
|
||||
add_definitions(-DMODULE_COMPILE)
|
||||
endif(WIN32)
|
||||
|
||||
# Set all the files to use C++ as well as set their compile flags (use the module-specific compile flags, though)
|
||||
set_source_files_properties(${PROTOCOL_SRCS} PROPERTIES LANGUAGE CXX COMPILE_FLAGS "${MODULE_CXXFLAGS}")
|
||||
set_source_files_properties(${PROTOCOL_SRCS} PROPERTIES LANGUAGE CXX COMPILE_FLAGS "${CXXFLAGS}")
|
||||
|
||||
# Iterate through all the source files
|
||||
foreach(SRC ${PROTOCOL_SRCS})
|
||||
@@ -18,7 +23,7 @@ foreach(SRC ${PROTOCOL_SRCS})
|
||||
# For Visual Studio only, include win32_memory.cpp to the list of sources, required to override Visual Studio's overrides of the new/delete operators
|
||||
if(MSVC)
|
||||
append_to_list(APPEND SRC ${Anope_SOURCE_DIR}/src/win32_memory.cpp)
|
||||
set_source_files_properties(${Anope_SOURCE_DIR}/src/win32_memory.cpp LANGUAGE CXX COMPILE_FLAGS "${MODULE_CXXFLAGS}")
|
||||
set_source_files_properties(${Anope_SOURCE_DIR}/src/win32_memory.cpp LANGUAGE CXX COMPILE_FLAGS "${CXXFLAGS}")
|
||||
endif(MSVC)
|
||||
# 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 ${SRC})
|
||||
|
||||
Reference in New Issue
Block a user