summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Anope.cmake35
-rw-r--r--CMakeLists.txt80
2 files changed, 2 insertions, 113 deletions
diff --git a/Anope.cmake b/Anope.cmake
index d944e1731..3a45a4b44 100644
--- a/Anope.cmake
+++ b/Anope.cmake
@@ -379,10 +379,7 @@ macro(calculate_depends SRC)
foreach(INCLUDE ${INCLUDES})
# Extract the filename from the #include line
extract_include_filename(${INCLUDE} FILENAME QUOTE_TYPE)
- if(QUOTE_TYPE STREQUAL "quotes")
- # Append the filename to the list of headers
- append_to_list(HEADERS ${FILENAME})
- else(QUOTE_TYPE STREQUAL "quotes")
+ if(QUOTE_TYPE STREQUAL "angle brackets")
# The following checks will only be done if there was a request for angle includes to be checked
if(CHECK_ANGLE_INCLUDES)
# Find the path of the include file
@@ -404,36 +401,8 @@ macro(calculate_depends SRC)
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(FOUND_${FILENAME}_INCLUDE)
endif(CHECK_ANGLE_INCLUDES)
- endif(QUOTE_TYPE STREQUAL "quotes")
+ endif(QUOTE_TYPE STREQUAL "angle brackets")
endforeach(INCLUDE)
- # Set the list of new headers to empty (this will store all the headers that the above list depends on)
- set(NEW_HEADERS)
- # Iterate through the list of headers
- foreach(HEADER ${HEADERS})
- # If the current header has it's own headers to depend on, append those to the list of new headers
- if(${HEADER}_HEADERS)
- append_to_list(NEW_HEADERS ${${HEADER}_HEADERS})
- endif(${HEADER}_HEADERS)
- endforeach(HEADER)
- # If there were new headers, append them to the list of headers
- if(NEW_HEADERS)
- append_to_list(HEADERS ${NEW_HEADERS})
- endif(NEW_HEADERS)
- # If after all the above there is a list of header, we'll process them, converting them to full paths
- if(HEADERS)
- # Remove duplicate headers from the list and sort the list
- remove_list_duplicates(HEADERS)
- sort_list(HEADERS)
- # Set the list of full path headers to empty
- set(HEADERS_FULL)
- # Iterate through the list of headers
- foreach(HEADER ${HEADERS})
- # Append the full path of the header to the full path headers list
- append_to_list(HEADERS_FULL ${${HEADER}_FULLPATH})
- endforeach(HEADER)
- # Set the given source file to depend on the headers given
- set_source_files_properties(${SRC} PROPERTIES OBJECT_DEPENDS "${HEADERS_FULL}")
- endif(HEADERS)
endmacro(calculate_depends)
###############################################################################
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9c021ea42..3f90997e1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -378,86 +378,6 @@ if(WIN32)
configure_file(${Anope_SOURCE_DIR}/src/win32.rc.cmake ${Anope_BINARY_DIR}/src/win32.rc)
endif(WIN32)
-# Calculate dependencies for each header
-# I would've done this inside the CMakeLists.txt for the include directory, but since it's added AFTER everything else, it won't help...
-
-# Firstly, find all the header files
-file(GLOB_RECURSE ALL_HEADERS "*.h")
-# Iterate through the headers
-foreach(HEADER ${ALL_HEADERS})
- # Don't process the file if it's in an obsolete directory
- if(NOT HEADER MATCHES ".*obsolete.*")
- append_to_list(TMP_HEADERS ${HEADER})
- # In addition, also set up a variable to store the fullpath of the header, in a variable prefixed with just the header's filename for easy access later
- get_filename_component(HEADER_FILENAME ${HEADER} NAME)
- set(${HEADER_FILENAME}_FULLPATH ${HEADER})
- endif(NOT HEADER MATCHES ".*obsolete.*")
-endforeach(HEADER)
-# Set the list of headers to be all the non-obsolete ones, then sort the list
-if(TMP_HEADERS)
- set(ALL_HEADERS ${TMP_HEADERS})
- sort_list(ALL_HEADERS)
-endif(TMP_HEADERS)
-
-# Preparse step 1: get filenames sans paths
-# Iterate through the headers
-foreach(HEADER ${ALL_HEADERS})
- # Find all the lines in the current header that have any form of #include on them, regardless of whitespace
- read_from_file(${HEADER} "^[ \t]*#[ \t]*include[ \t]*\".*\"[ \t]*$" INCLUDES)
- # Get the filename only of the header we just checked
- get_filename_component(HEADER_FILENAME ${HEADER} NAME)
- # Iterate through the strings containing #include (if any)
- foreach(INCLUDE ${INCLUDES})
- # Extract the filename from the #include line
- extract_include_filename(${INCLUDE} FILENAME)
- # Append this filename to the list of headers for the header we are checking
- append_to_list(${HEADER_FILENAME}_HEADERS ${FILENAME})
- endforeach(INCLUDE)
-endforeach(HEADER)
-
-# Preparse step 2: for every header from above that had includes, recursively find the headers each header relies on
-# Iterate through the headers (again)
-foreach(HEADER ${ALL_HEADERS})
- # Get the filename only of the current header
- get_filename_component(HEADER_FILENAME ${HEADER} NAME)
- # If there were any include, we'll be checking them
- if(${HEADER_FILENAME}_HEADERS)
- # Set the variables, old for all previously found headers, new for all newly found headers
- set(OLD_HEADERS)
- set(HEADERS ${${HEADER_FILENAME}_HEADERS})
- set(NEW_HEADERS)
- # Loop as long as there are still headers to be parsed
- while(HEADERS)
- # Iterate through the list of the current headers
- foreach(CURR_HEADER ${HEADERS})
- # If that header has headers it relies on, we'll add them to the list of new headers
- if(${CURR_HEADER}_HEADERS)
- foreach(CURR_HEADERS_HEADER ${${CURR_HEADER}_HEADERS})
- append_to_list(NEW_HEADERS ${CURR_HEADERS_HEADER})
- endforeach(CURR_HEADERS_HEADER)
- endif(${CURR_HEADER}_HEADERS)
- endforeach(CURR_HEADER)
- # Append the headers we checked to the old headers
- append_to_list(OLD_HEADERS ${HEADERS})
- # Set the headers to check to the new headers (it may be empty and that'll exit the loop)
- set(HEADERS ${NEW_HEADERS})
- # Erase the new headers
- set(NEW_HEADERS)
- endwhile(HEADERS)
- # OLD_HEADERS will now contain all headers that the current header relies on, remove duplicate headers from the list and sort the list
- remove_list_duplicates(OLD_HEADERS)
- sort_list(OLD_HEADERS)
- # Set the current header's list of headers to the cleaned up list from above
- set(${HEADER_FILENAME}_HEADERS ${OLD_HEADERS})
- endif(${HEADER_FILENAME}_HEADERS)
-endforeach(HEADER)
-
-# The following headers are generated from CMake rules and won't be found with the above
-append_to_list(ALL_HEADERS ${Anope_BINARY_DIR}/lang/language.h ${Anope_BINARY_DIR}/include/sysconf.h ${Anope_BINARY_DIR}/include/version.h)
-set(language.h_FULLPATH ${Anope_BINARY_DIR}/lang/language.h)
-set(sysconf.h_FULLPATH ${Anope_BINARY_DIR}/include/sysconf.h)
-set(version.h_FULLPATH ${Anope_BINARY_DIR}/include/version.h)
-
# 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\;.svn\;CMakeFiles\;sysconf.h$\;Makefile.inc$\;config.log\;config.status\;build\;autom4te.cache" TRUE)
# Add the files we don't want the periods converted for