From d30e53ee2c87ae1fdeb276a3a79b82370e36f7b0 Mon Sep 17 00:00:00 2001 From: Naram Qashat Date: Sat, 22 Sep 2012 03:45:51 -0400 Subject: [PATCH] OK, so the FIND sub-command of string() in CMake was only added with 2.8.5, change this to use the REGEX sub-commands instead. Also while I'm at it, make -pthread only get added when not on Mac OS X, it's auto-included there. --- CMakeLists.txt | 9 ++++----- cmake/Anope.cmake | 6 ++++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5e0da5f0e..3590cf986 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -133,10 +133,7 @@ if(CMAKE_COMPILER_IS_GNUCXX) math(EXPR LINE_LENGTH "${LINE_LENGTH} - 1") string(SUBSTRING ${LINE} 1 ${LINE_LENGTH} INCLUDE) # For systems like Mac OS X, look for include paths that say " (framework directory)" at the end of them and strip that off - string(FIND ${INCLUDE} " (framework directory)" FRAMEWORK) - if(NOT FRAMEWORK EQUAL -1) - string(SUBSTRING ${INCLUDE} 0 ${FRAMEWORK} INCLUDE) - endif(NOT FRAMEWORK EQUAL -1) + string(REGEX REPLACE " \\(framework directory\\)$" "" INCLUDE ${INCLUDE}) # Convert the path to an absolute one, just in case it wasn't get_filename_component(INCLUDE ${INCLUDE} ABSOLUTE) # Add that directory to the list of default include directories @@ -313,7 +310,9 @@ if(NOT MSVC) # 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) - set(LDFLAGS "${LDFLAGS} -pthread") + if(NOT APPLE) + set(LDFLAGS "${LDFLAGS} -pthread") + endif(NOT APPLE) else(HAVE_PTHREAD) message(FATAL_ERROR "The pthread library is required to build Anope") endif(HAVE_PTHREAD) diff --git a/cmake/Anope.cmake b/cmake/Anope.cmake index fa6c133d6..252d54ca3 100644 --- a/cmake/Anope.cmake +++ b/cmake/Anope.cmake @@ -395,10 +395,12 @@ macro(calculate_depends SRC SKIP) # 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 set(FOUND_IN_DEFAULTS -1) foreach(DEFAULT_INCLUDE_DIR ${DEFAULT_INCLUDE_DIRS}) + string(REGEX REPLACE "\\+" "\\\\+" DEFAULT_INCLUDE_DIR ${DEFAULT_INCLUDE_DIR}) + string(REGEX MATCH ${DEFAULT_INCLUDE_DIR} FOUND_DEFAULT ${FOUND_${FILENAME}_INCLUDE}) string(FIND ${FOUND_${FILENAME}_INCLUDE} ${DEFAULT_INCLUDE_DIR} FOUND_DEFAULT) - if(NOT FOUND_DEFAULT EQUAL -1) + if(FOUND_DEFAULT) set(FOUND_IN_DEFAULTS 0) - endif(NOT FOUND_DEFAULT EQUAL -1) + endif(FOUND_DEFAULT) endforeach(DEFAULT_INCLUDE_DIR) if(FOUND_IN_DEFAULTS EQUAL -1) find_in_list(${ARGV2} "${FOUND_${FILENAME}_INCLUDE}" FOUND_IN_INCLUDES)