summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmake/Anope.cmake22
-rw-r--r--modules/CMakeLists.txt14
-rw-r--r--src/CMakeLists.txt3
-rw-r--r--src/tools/CMakeLists.txt3
4 files changed, 23 insertions, 19 deletions
diff --git a/cmake/Anope.cmake b/cmake/Anope.cmake
index 3f49dd650..3f9165106 100644
--- a/cmake/Anope.cmake
+++ b/cmake/Anope.cmake
@@ -359,12 +359,12 @@ macro(find_includes SRC INCLUDES)
endmacro(find_includes)
###############################################################################
-# calculate_depends(<source filename> <output variable set to TRUE on fail> <TRUE to output error messages> [<optional output variable for includes>])
+# calculate_depends(<source filename> <output variable set to TRUE on fail> <TRUE if the source file is a module> [<optional output variable for includes>])
#
# This macro is used in most of the src (sub)directories to calculate the
# header file dependencies for the given source file.
###############################################################################
-macro(calculate_depends SRC SKIP VERBOSE)
+macro(calculate_depends SRC SKIP MODULE)
# Temporarily set that we didn't get a 3rd argument before we actually check if we did get one or not
set(CHECK_ANGLE_INCLUDES FALSE)
# Check for a third argument
@@ -409,9 +409,11 @@ macro(calculate_depends SRC SKIP VERBOSE)
endif(FOUND_IN_DEFAULTS EQUAL -1)
else(FOUND_${FILENAME}_INCLUDE)
set(${SKIP} TRUE)
- if(VERBOSE)
- message("${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(VERBOSE)
+ if(NOT ${MODULE})
+ 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.")
+ else(NOT ${MODULE})
+ message(" ${SRC} can not be built due to missing dependencies - requires header file ${FILENAME}")
+ endif(NOT ${MODULE})
endif(FOUND_${FILENAME}_INCLUDE)
endif(CHECK_ANGLE_INCLUDES)
endif(QUOTE_TYPE STREQUAL "angle brackets")
@@ -419,12 +421,12 @@ macro(calculate_depends SRC SKIP VERBOSE)
endmacro(calculate_depends)
###############################################################################
-# calculate_libraries(<source filename> <output variable set to TRUE on fail> <TRUE to output error messages> <output variable for linker flags> <output variable for extra depends>)
+# calculate_libraries(<source filename> <output variable set to TRUE on fail> <TRUE if the source file is a module> <output variable for linker flags> <output variable for extra depends>)
#
# This macro is used in most of the module (sub)directories to calculate the
# library dependencies for the given source file.
###############################################################################
-macro(calculate_libraries SRC SKIP VERBOSE SRC_LDFLAGS EXTRA_DEPENDS)
+macro(calculate_libraries SRC SKIP MODULE SRC_LDFLAGS EXTRA_DEPENDS)
# Set up a temporary LDFLAGS for this file
set(THIS_LDFLAGS "${LDFLAGS}")
# Reset extra dependencies
@@ -466,10 +468,12 @@ macro(calculate_libraries SRC SKIP VERBOSE SRC_LDFLAGS EXTRA_DEPENDS)
else(FOUND_${LIBRARY}_LIBRARY)
# Skip this file
set(${SKIP} TRUE)
- if(VERBOSE)
+ if(NOT ${MODULE})
# 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(VERBOSE)
+ else(NOT ${MODULE})
+ message(" ${SRC} can not be built due to missing dependencies - requires library ${LIBRARY}")
+ endif(NOT ${MODULE})
endif(FOUND_${LIBRARY}_LIBRARY)
endforeach(LIBRARY)
endforeach(REQUIRED_LIBRARY)
diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt
index 1402a7c68..75d22af4a 100644
--- a/modules/CMakeLists.txt
+++ b/modules/CMakeLists.txt
@@ -22,6 +22,8 @@ foreach(MODULE_FOLDER ${MODULES_FOLDERS})
# Create an empty list to store extra include directories
set(EXTRA_INCLUDES)
+ set(MODULE TRUE)
+
# Get the length of the folder name
string(LENGTH ${MODULE_FOLDER} FOLDER_LEN)
# Add one (the /)
@@ -42,7 +44,7 @@ foreach(MODULE_FOLDER ${MODULES_FOLDERS})
# Temporary variable for the current source's include directories
set(TEMP_INCLUDES)
# Calculate the header file dependencies for the given source file
- calculate_depends(${SRC} SKIP_DEPENDS FALSE TEMP_INCLUDES)
+ calculate_depends(${SRC} SKIP_DEPENDS MODULE TEMP_INCLUDES)
# If there were some extra include directories, add them to the list
if(TEMP_INCLUDES)
append_to_list(EXTRA_INCLUDES ${TEMP_INCLUDES})
@@ -54,7 +56,7 @@ foreach(MODULE_FOLDER ${MODULES_FOLDERS})
# Reset skip_libraries
set(SKIP_LIBRARIES)
# Calculate the library dependencies for the given source file
- calculate_libraries(${SRC} SKIP_LIBRARIES FALSE TEMP_LDFLAGS TEMP_DEPENDENCIES)
+ calculate_libraries(${SRC} SKIP_LIBRARIES MODULE TEMP_LDFLAGS TEMP_DEPENDENCIES)
if(NOT SKIP_DEPENDS AND NOT SKIP_LIBRARIES)
# Reset has_function
set(HAS_FUNCTION)
@@ -93,8 +95,6 @@ foreach(MODULE_FOLDER ${MODULES_FOLDERS})
DESTINATION ${LIB_DIR}/modules
)
endif(HAS_FUNCTION)
- else(NOT SKIP_DEPENDS AND NOT SKIP_LIBRARIES)
- message(" ${SRC} can not be built due to missing dependencies.")
endif(NOT SKIP_DEPENDS AND NOT SKIP_LIBRARIES)
endforeach(SRC)
@@ -137,7 +137,7 @@ foreach(MODULE_FOLDER ${MODULES_FOLDERS})
# Temporary variable for the current source's include directories
set(TEMP_INCLUDES)
# Calculate the header file dependencies for the given source file
- calculate_depends(${SRC} SKIP_DEPENDS FALSE TEMP_INCLUDES)
+ calculate_depends(${SRC} SKIP_DEPENDS MODULE TEMP_INCLUDES)
# If there were some extra include directories, add them to the list
if(TEMP_INCLUDES)
append_to_list(EXTRA_INCLUDES ${TEMP_INCLUDES})
@@ -147,7 +147,7 @@ foreach(MODULE_FOLDER ${MODULES_FOLDERS})
# Reset extra dependencies
set(TEMP_DEPENDENCIES)
# Calculate the library dependencies for the given source file
- calculate_libraries(${SRC} SKIP_LIBRARIES FALSE TEMP_LDFLAGS TEMP_DEPENDENCIES)
+ calculate_libraries(${SRC} SKIP_LIBRARIES MODULE TEMP_LDFLAGS TEMP_DEPENDENCIES)
# Check the function dependencies for the given source file
check_functions(${SRC} HAS_FUNCTION)
@@ -193,8 +193,6 @@ foreach(MODULE_FOLDER ${MODULES_FOLDERS})
install(TARGETS ${SO}
DESTINATION ${LIB_DIR}/modules
)
- else(NOT SKIP_DEPENDS AND NOT SKIP_LIBRARIES AND HAS_FUNCTION)
- message(" ${SUBDIR} can not be built due to missing dependencies.")
endif(NOT SKIP_DEPENDS AND NOT SKIP_LIBRARIES AND HAS_FUNCTION)
# Run the directories CMakeLists.txt if there is one
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index d2bc9f050..e2dbb6c71 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -38,8 +38,9 @@ foreach(SRC ${SRC_SRCS})
set(TEMP_INCLUDES)
# Create unused skip variable
set(SKIP)
+ set(MODULE FALSE)
# Calculate the header file dependencies for the given source file
- calculate_depends(${SRC} SKIP TRUE TEMP_INCLUDES)
+ calculate_depends(${SRC} SKIP MODULE TEMP_INCLUDES)
# If there were some extra include directories, add them to the list
if(TEMP_INCLUDES)
append_to_list(EXTRA_INCLUDES ${TEMP_INCLUDES})
diff --git a/src/tools/CMakeLists.txt b/src/tools/CMakeLists.txt
index 613e4ffc6..962849d8b 100644
--- a/src/tools/CMakeLists.txt
+++ b/src/tools/CMakeLists.txt
@@ -11,8 +11,9 @@ foreach(SRC ${TOOLS_SRCS})
string(REGEX REPLACE "\\.cpp$" "" EXE ${SRC})
# Create skip variable
set(SKIP)
+ set(MODULE FALSE)
# Calculate the header file dependencies for the given source file
- calculate_depends(${SRC} SKIP TRUE)
+ calculate_depends(${SRC} SKIP MODULE)
# Only continue if this file isn't skipped
if(NOT SKIP)
# Generate the executable and set its linker flags, also set it to depend on the main Anope executable to be built beforehand