diff options
author | cyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-11-15 21:14:11 +0000 |
---|---|---|
committer | cyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-11-15 21:14:11 +0000 |
commit | 7eadde991142f993923e425e5a8bebfe1b7b3cee (patch) | |
tree | c51ae51f71114bc08f4c4dbb1a60b3939deb1d28 /CMakeLists.txt | |
parent | 8e8a1d96e4daa37ccb5950e80185000d8735e3b0 (diff) |
Possible fix for header dependency calculation causing CMake to freeze due to recursive including, fixed by removing my code to do that and letting CMake figure this out on it's own. Seems to work here, but might need testing still.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2651 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 80 |
1 files changed, 0 insertions, 80 deletions
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 |