diff options
79 files changed, 1080 insertions, 1219 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 386d5b7b0d..146f56da15 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -354,7 +354,7 @@ ENDMACRO (CMAKE_BUILD_UTILITIES) SET(CMake_VERSION_MAJOR 2) SET(CMake_VERSION_MINOR 6) SET(CMake_VERSION_PATCH 1) -SET(CMake_VERSION_RC 3) +SET(CMake_VERSION_RC 4) # CVS versions are odd, if this is an odd minor version # then set the CMake_VERSION_DATE variable IF("${CMake_VERSION_MINOR}" MATCHES "[13579]$") diff --git a/ChangeLog.manual b/ChangeLog.manual index 19d6675145..dee6ce47f0 100644 --- a/ChangeLog.manual +++ b/ChangeLog.manual @@ -1,10 +1,29 @@ +Changes in CMake 2.6.1 RC 4 +- Change to find_*, a new HINTS keyword was added to avoid the + need for NO_DEFAULT_PATH, and a repeated call to find_* +- Update all NO_DEFAULT_PATH usage in Modules/Find* +- Fix for cpack self extracting .sh files to work with more shells +- FindQt4 now finds dependencies for some qt modules +- ctest cpu information fixes for cygwin and linux +- Recognize more color terminals for color output +- Remove SKIP_RULE_DEPENDS from custom command because CMake + now can detect when a cutom command actually changes and only + re-run the rule then. This fixes the problem of custom commands + re-running every time a file is added to a target. +- Fix for very slow find_path on OSX because of framework searchs +- Fix for bug 6364, extra help targets when there are subdirectories + of the top level. +- Fix for Xcode generator to not eat some flags by mistake. +- Add end of file checking for close if, foreach, macro, functions + etc enabled. + Changes in CMake 2.6.1 RC 3 - FindQt4 - Find qt debug libraries on windows with d postfix. - Find 64 bit windows registry stuff with 32 bit cmake - Give a message if rpath is changed during install - rpath changer during install understands symlinks now -- If a source file is not found and is a full path cmake complains again -- +- If a source file is not found and is a full path cmake complains. + Changes in CMake 2.6.1 RC 2 - FindQt4 - report an error when trying to use MSVC with Qt built by mingw. diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake index 9d76e75e95..dc646730cf 100644 --- a/Modules/CMakeFindBinUtils.cmake +++ b/Modules/CMakeFindBinUtils.cmake @@ -22,8 +22,7 @@ IF("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC" OR "${CMAKE_C_COMPILER_ID}" MATCHES "MSVC" OR "${CMAKE_GENERATOR}" MATCHES "Visual Studio") - FIND_PROGRAM(CMAKE_LINKER NAMES link PATHS ${_CMAKE_TOOLCHAIN_LOCATION} NO_DEFAULT_PATH) - FIND_PROGRAM(CMAKE_LINKER NAMES link) + FIND_PROGRAM(CMAKE_LINKER NAMES link HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) MARK_AS_ADVANCED(CMAKE_LINKER) @@ -32,29 +31,18 @@ ELSE("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC" OR "${CMAKE_C_COMPILER_ID}" MATCHES "MSVC" OR "${CMAKE_GENERATOR}" MATCHES "Visual Studio") - FIND_PROGRAM(CMAKE_AR NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ar PATHS ${_CMAKE_TOOLCHAIN_LOCATION} NO_DEFAULT_PATH) - FIND_PROGRAM(CMAKE_AR NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ar) + FIND_PROGRAM(CMAKE_AR NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ar HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) - FIND_PROGRAM(CMAKE_RANLIB NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ranlib ${_CMAKE_TOOLCHAIN_LOCATION} NO_DEFAULT_PATH) - FIND_PROGRAM(CMAKE_RANLIB NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ranlib) + FIND_PROGRAM(CMAKE_RANLIB NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ranlib HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) IF(NOT CMAKE_RANLIB) SET(CMAKE_RANLIB : CACHE INTERNAL "noop for ranlib") ENDIF(NOT CMAKE_RANLIB) - FIND_PROGRAM(CMAKE_STRIP NAMES ${_CMAKE_TOOLCHAIN_PREFIX}strip PATHS ${_CMAKE_TOOLCHAIN_LOCATION} NO_DEFAULT_PATH) - FIND_PROGRAM(CMAKE_STRIP NAMES ${_CMAKE_TOOLCHAIN_PREFIX}strip) - - FIND_PROGRAM(CMAKE_LINKER NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ld PATHS ${_CMAKE_TOOLCHAIN_LOCATION} NO_DEFAULT_PATH) - FIND_PROGRAM(CMAKE_LINKER NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ld) - - FIND_PROGRAM(CMAKE_NM NAMES ${_CMAKE_TOOLCHAIN_PREFIX}nm PATHS ${_CMAKE_TOOLCHAIN_LOCATION} NO_DEFAULT_PATH) - FIND_PROGRAM(CMAKE_NM NAMES ${_CMAKE_TOOLCHAIN_PREFIX}nm) - - FIND_PROGRAM(CMAKE_OBJDUMP NAMES ${_CMAKE_TOOLCHAIN_PREFIX}objdump PATHS ${_CMAKE_TOOLCHAIN_LOCATION} NO_DEFAULT_PATH) - FIND_PROGRAM(CMAKE_OBJDUMP NAMES ${_CMAKE_TOOLCHAIN_PREFIX}objdump) - - FIND_PROGRAM(CMAKE_OBJCOPY NAMES ${_CMAKE_TOOLCHAIN_PREFIX}objcopy PATHS ${_CMAKE_TOOLCHAIN_LOCATION} NO_DEFAULT_PATH) - FIND_PROGRAM(CMAKE_OBJCOPY NAMES ${_CMAKE_TOOLCHAIN_PREFIX}objcopy) + FIND_PROGRAM(CMAKE_STRIP NAMES ${_CMAKE_TOOLCHAIN_PREFIX}strip HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) + FIND_PROGRAM(CMAKE_LINKER NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ld HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) + FIND_PROGRAM(CMAKE_NM NAMES ${_CMAKE_TOOLCHAIN_PREFIX}nm HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) + FIND_PROGRAM(CMAKE_OBJDUMP NAMES ${_CMAKE_TOOLCHAIN_PREFIX}objdump HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) + FIND_PROGRAM(CMAKE_OBJCOPY NAMES ${_CMAKE_TOOLCHAIN_PREFIX}objcopy HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) MARK_AS_ADVANCED(CMAKE_AR CMAKE_RANLIB CMAKE_STRIP CMAKE_LINKER CMAKE_NM CMAKE_OBJDUMP CMAKE_OBJCOPY) @@ -65,8 +53,7 @@ ENDIF("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC" # on Apple there really should be install_name_tool IF(APPLE) - FIND_PROGRAM(CMAKE_INSTALL_NAME_TOOL NAMES install_name_tool PATHS ${_CMAKE_TOOLCHAIN_LOCATION} NO_DEFAULT_PATH) - FIND_PROGRAM(CMAKE_INSTALL_NAME_TOOL NAMES install_name_tool) + FIND_PROGRAM(CMAKE_INSTALL_NAME_TOOL NAMES install_name_tool HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) IF(NOT CMAKE_INSTALL_NAME_TOOL) MESSAGE(FATAL_ERROR "Could not find install_name_tool, please check your installation.") diff --git a/Modules/CPack.RuntimeScript.in b/Modules/CPack.RuntimeScript.in index fc3444abfd..72dd14ec47 100755 --- a/Modules/CPack.RuntimeScript.in +++ b/Modules/CPack.RuntimeScript.in @@ -6,7 +6,7 @@ CWD="`dirname \"$0\"`" TMP=/tmp/$UID/TemporaryItems version=`sw_vers -productVersion` -if [ "$?" == "0" ]; then +if [ "$?" = "0" ]; then major=${version%%\.*} rest=${version#*\.} minor=${rest%%\.*} @@ -36,7 +36,7 @@ cat << __END_OF_GETDISPLAY_SCRIPT__ > "$TMP/getdisplay.sh" #!/bin/sh mkdir -p "$TMP" -if [ "\$DISPLAY"x == "x" ]; then +if [ "\$DISPLAY"x = "x" ]; then echo :0 > "$TMP/display" else echo \$DISPLAY > "$TMP/display" @@ -48,7 +48,7 @@ open-x11 $TMP/getdisplay.sh || \ open -a XDarwin $TMP/getdisplay.sh || \ echo ":0" > $TMP/display -while [ "$?" == "0" -a ! -f $TMP/display ]; +while [ "$?" = "0" -a ! -f $TMP/display ]; do #echo "Waiting for display $TMP/display" sleep 1; diff --git a/Modules/FindCurses.cmake b/Modules/FindCurses.cmake index c854ba8e54..6c8de0c1c7 100644 --- a/Modules/FindCurses.cmake +++ b/Modules/FindCurses.cmake @@ -66,12 +66,10 @@ ELSE(NOT CURSES_USE_NCURSES) FIND_FILE(CURSES_HAVE_NCURSES_H ncurses.h) FIND_FILE(CURSES_HAVE_NCURSES_NCURSES_H ncurses/ncurses.h) FIND_FILE(CURSES_HAVE_NCURSES_CURSES_H ncurses/curses.h) - FIND_FILE(CURSES_HAVE_CURSES_H curses.h PATHS "${_cursesParentDir}/include" NO_DEFAULT_PATH) - FIND_FILE(CURSES_HAVE_CURSES_H curses.h) + FIND_FILE(CURSES_HAVE_CURSES_H curses.h HINTS "${_cursesParentDir}/include") FIND_PATH(CURSES_NCURSES_INCLUDE_PATH ncurses.h ncurses/ncurses.h ncurses/curses.h) - FIND_PATH(CURSES_NCURSES_INCLUDE_PATH curses.h PATHS "${_cursesParentDir}/include" NO_DEFAULT_PATH) - FIND_PATH(CURSES_NCURSES_INCLUDE_PATH curses.h) + FIND_PATH(CURSES_NCURSES_INCLUDE_PATH curses.h HINTS "${_cursesParentDir}/include") # for compatibility with older FindCurses.cmake this has to be in the cache # FORCE must not be used since this would break builds which preload a cache wqith these variables set @@ -81,10 +79,10 @@ ENDIF(NOT CURSES_USE_NCURSES) -FIND_LIBRARY(CURSES_EXTRA_LIBRARY cur_colr PATHS "${_cursesLibDir}" NO_DEFAULT_PATH) +FIND_LIBRARY(CURSES_EXTRA_LIBRARY cur_colr HINTS "${_cursesLibDir}") FIND_LIBRARY(CURSES_EXTRA_LIBRARY cur_colr ) -FIND_LIBRARY(CURSES_FORM_LIBRARY form PATHS "${_cursesLibDir}" NO_DEFAULT_PATH) +FIND_LIBRARY(CURSES_FORM_LIBRARY form HINTS "${_cursesLibDir}") FIND_LIBRARY(CURSES_FORM_LIBRARY form ) # for compatibility with older FindCurses.cmake this has to be in the cache diff --git a/Modules/FindFreetype.cmake b/Modules/FindFreetype.cmake index c128c47c8f..3c83bfa7db 100644 --- a/Modules/FindFreetype.cmake +++ b/Modules/FindFreetype.cmake @@ -29,13 +29,9 @@ # I'm going to attempt to cut out the middleman and hope # everything still works. FIND_PATH(FREETYPE_INCLUDE_DIR_ft2build ft2build.h + HINTS $ENV{FREETYPE_DIR} - NO_DEFAULT_PATH PATH_SUFFIXES include -) - - -FIND_PATH(FREETYPE_INCLUDE_DIR_ft2build ft2build.h PATHS /usr/local/X11R6/include /usr/local/X11/include @@ -46,11 +42,9 @@ FIND_PATH(FREETYPE_INCLUDE_DIR_ft2build ft2build.h ) FIND_PATH(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h + HINTS $ENV{FREETYPE_DIR}/include/freetype2 - NO_DEFAULT_PATH -) - -FIND_PATH(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h + PATHS /usr/local/X11R6/include /usr/local/X11/include /usr/X11/include @@ -62,21 +56,15 @@ FIND_PATH(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h FIND_LIBRARY(FREETYPE_LIBRARY NAMES freetype libfreetype freetype219 - PATHS + HINTS $ENV{FREETYPE_DIR} - NO_DEFAULT_PATH - PATH_SUFFIXES lib64 lib -) - -FIND_LIBRARY(FREETYPE_LIBRARY - NAMES freetype libfreetype freetype219 + PATH_SUFFIXES lib64 lib PATHS /usr/local/X11R6 /usr/local/X11 /usr/X11 /sw /usr/freeware - PATH_SUFFIXES lib64 lib ) # set the user variables diff --git a/Modules/FindGDAL.cmake b/Modules/FindGDAL.cmake index a92b04c63b..e21fe833ef 100644 --- a/Modules/FindGDAL.cmake +++ b/Modules/FindGDAL.cmake @@ -20,14 +20,9 @@ # #include "gdal.h" FIND_PATH(GDAL_INCLUDE_DIR gdal.h + HINTS $ENV{GDAL_DIR} - NO_DEFAULT_PATH - PATH_SUFFIXES include -) - - - -FIND_PATH(GDAL_INCLUDE_DIR gdal.h + PATH_SUFFIXES include PATHS ~/Library/Frameworks/gdal.framework/Headers /Library/Frameworks/gdal.framework/Headers @@ -53,14 +48,9 @@ FIND_PATH(GDAL_INCLUDE_DIR gdal.h FIND_LIBRARY(GDAL_LIBRARY NAMES gdal GDAL - PATHS + HINTS $ENV{GDAL_DIR} - NO_DEFAULT_PATH PATH_SUFFIXES lib64 lib -) - -FIND_LIBRARY(GDAL_LIBRARY - NAMES gdal GDAL PATHS ~/Library/Frameworks /Library/Frameworks @@ -72,7 +62,6 @@ FIND_LIBRARY(GDAL_LIBRARY /opt /usr/freeware [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;GDAL_ROOT]/lib - PATH_SUFFIXES lib64 lib ) SET(GDAL_FOUND "NO") diff --git a/Modules/FindGIF.cmake b/Modules/FindGIF.cmake index 305be68212..1d3a5ec1ee 100644 --- a/Modules/FindGIF.cmake +++ b/Modules/FindGIF.cmake @@ -10,15 +10,9 @@ # Modifications by Alexander Neundorf FIND_PATH(GIF_INCLUDE_DIR gif_lib.h - PATHS + HINTS $ENV{GIF_DIR} - NO_DEFAULT_PATH PATH_SUFFIXES include -) - - - -FIND_PATH(GIF_INCLUDE_DIR gif_lib.h PATHS ~/Library/Frameworks /Library/Frameworks @@ -32,16 +26,9 @@ SET(POTENTIAL_GIF_LIBS gif libgif ungif libungif giflib) FIND_LIBRARY(GIF_LIBRARY NAMES ${POTENTIAL_GIF_LIBS} - PATHS + HINTS $ENV{GIF_DIR} - NO_DEFAULT_PATH PATH_SUFFIXES lib64 lib -) - - - -FIND_LIBRARY(GIF_LIBRARY - NAMES ${POTENTIAL_GIF_LIBS} PATHS ~/Library/Frameworks /Library/Frameworks @@ -53,7 +40,6 @@ FIND_LIBRARY(GIF_LIBRARY /opt [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT] /usr/freeware - PATH_SUFFIXES lib64 lib ) # see readme.txt diff --git a/Modules/FindKDE3.cmake b/Modules/FindKDE3.cmake index d8ef875c9b..79d66ec497 100644 --- a/Modules/FindKDE3.cmake +++ b/Modules/FindKDE3.cmake @@ -103,27 +103,15 @@ ENDIF (NOT CMAKE_BUILD_TYPE) #SET(CMAKE_SHARED_LINKER_FLAGS "-Wl,--fatal-warnings -avoid-version -Wl,--no-undefined -lc") #SET(CMAKE_MODULE_LINKER_FLAGS "-Wl,--fatal-warnings -avoid-version -Wl,--no-undefined -lc") -# all calls to FIND_PROGRAM/PATH/LIBRARY() follow the same scheme: -# at first try some special paths with the argument "NO_DEFAULT_PATH" -# so only these paths are checked -# this is followed by a second call to FIND_PROGRAM/PATH/LIBRARY() -# but this time without any paths and without NO_DEFAULT_PATH -# this second call will do nothing if the first call already found -# what it was looking for, if not, it will search only in the default -# directories (/usr, /usr/local, etc.) - #now try to find some kde stuff -FIND_PROGRAM(KDECONFIG_EXECUTABLE NAMES kde-config PATHS +FIND_PROGRAM(KDECONFIG_EXECUTABLE NAMES kde-config + HINTS $ENV{KDEDIR}/bin + PATHS /opt/kde3/bin /opt/kde/bin - NO_DEFAULT_PATH ) - -FIND_PROGRAM(KDECONFIG_EXECUTABLE kde-config) - - SET(KDE3PREFIX) IF(KDECONFIG_EXECUTABLE) EXECUTE_PROCESS(COMMAND ${KDECONFIG_EXECUTABLE} --version @@ -143,29 +131,26 @@ ENDIF(KDECONFIG_EXECUTABLE) # at first the KDE include direcory # kpassdlg.h comes from kdeui and doesn't exist in KDE4 anymore FIND_PATH(KDE3_INCLUDE_DIR kpassdlg.h + HINTS $ENV{KDEDIR}/include ${KDE3PREFIX}/include + PATHS /opt/kde3/include /opt/kde/include /usr/include/kde /usr/local/include/kde - NO_DEFAULT_PATH ) -FIND_PATH(KDE3_INCLUDE_DIR kpassdlg.h) - #now the KDE library directory FIND_LIBRARY(KDE3_KDECORE_LIBRARY NAMES kdecore - PATHS + HINTS $ENV{KDEDIR}/lib ${KDE3PREFIX}/lib + PATHS /opt/kde3/lib /opt/kde/lib - NO_DEFAULT_PATH ) -FIND_LIBRARY(KDE3_KDECORE_LIBRARY NAMES kdecore) - SET(QT_AND_KDECORE_LIBS ${QT_LIBRARIES} ${KDE3_KDECORE_LIBRARY}) GET_FILENAME_COMPONENT(KDE3_LIB_DIR ${KDE3_KDECORE_LIBRARY} PATH ) @@ -179,36 +164,33 @@ IF(NOT KDE3_LIBTOOL_DIR) ENDIF(NOT KDE3_LIBTOOL_DIR) #now search for the dcop utilities -FIND_PROGRAM(KDE3_DCOPIDL_EXECUTABLE NAMES dcopidl PATHS +FIND_PROGRAM(KDE3_DCOPIDL_EXECUTABLE NAMES dcopidl + HINTS $ENV{KDEDIR}/bin ${KDE3PREFIX}/bin + PATHS /opt/kde3/bin /opt/kde/bin - NO_DEFAULT_PATH ) -FIND_PROGRAM(KDE3_DCOPIDL_EXECUTABLE NAMES dcopidl) - -FIND_PROGRAM(KDE3_DCOPIDL2CPP_EXECUTABLE NAMES dcopidl2cpp PATHS +FIND_PROGRAM(KDE3_DCOPIDL2CPP_EXECUTABLE NAMES dcopidl2cpp + HINTS $ENV{KDEDIR}/bin ${KDE3PREFIX}/bin + PATHS /opt/kde3/bin /opt/kde/bin - NO_DEFAULT_PATH ) -FIND_PROGRAM(KDE3_DCOPIDL2CPP_EXECUTABLE NAMES dcopidl2cpp) - -FIND_PROGRAM(KDE3_KCFGC_EXECUTABLE NAMES kconfig_compiler PATHS +FIND_PROGRAM(KDE3_KCFGC_EXECUTABLE NAMES kconfig_compiler + HINTS $ENV{KDEDIR}/bin ${KDE3PREFIX}/bin + PATHS /opt/kde3/bin /opt/kde/bin - NO_DEFAULT_PATH ) -FIND_PROGRAM(KDE3_KCFGC_EXECUTABLE NAMES kconfig_compiler) - # KDE3Macros.cmake contains all the KDE specific macros INCLUDE(KDE3Macros) diff --git a/Modules/FindKDE4.cmake b/Modules/FindKDE4.cmake index 3d32fcc0d8..bd69296f60 100644 --- a/Modules/FindKDE4.cmake +++ b/Modules/FindKDE4.cmake @@ -20,16 +20,13 @@ FILE(TO_CMAKE_PATH "$ENV{KDEDIRS}" _KDEDIRS) FIND_PROGRAM(KDE4_KDECONFIG_EXECUTABLE NAMES kde4-config # the suffix must be used since KDEDIRS can be a list of directories which don't have bin/ appended PATH_SUFFIXES bin - PATHS + HINTS ${CMAKE_INSTALL_PREFIX} ${_KDEDIRS} /opt/kde4 - NO_DEFAULT_PATH ONLY_CMAKE_FIND_ROOT_PATH ) -FIND_PROGRAM(KDE4_KDECONFIG_EXECUTABLE NAMES kde4-config ONLY_CMAKE_FIND_ROOT_PATH) - IF (NOT KDE4_KDECONFIG_EXECUTABLE) IF (KDE4_FIND_REQUIRED) MESSAGE(FATAL_ERROR "ERROR: Could not find KDE4 kde4-config") diff --git a/Modules/FindLua50.cmake b/Modules/FindLua50.cmake index dce4837760..a5e8c51656 100644 --- a/Modules/FindLua50.cmake +++ b/Modules/FindLua50.cmake @@ -13,13 +13,9 @@ FIND_PATH(LUA_INCLUDE_DIR lua.h - PATHS + HINTS $ENV{LUA_DIR} - NO_DEFAULT_PATH PATH_SUFFIXES include/lua50 include/lua5.0 include/lua5 include/lua include -) - -FIND_PATH(LUA_INCLUDE_DIR lua.h PATHS ~/Library/Frameworks /Library/Frameworks @@ -29,19 +25,13 @@ FIND_PATH(LUA_INCLUDE_DIR lua.h /opt/local # DarwinPorts /opt/csw # Blastwave /opt - PATH_SUFFIXES include/lua50 include/lua5.0 include/lua5 include/lua include ) FIND_LIBRARY(LUA_LIBRARY_lua NAMES lua50 lua5.0 lua5 lua - PATHS + HINTS $ENV{LUA_DIR} - NO_DEFAULT_PATH - PATH_SUFFIXES lib64 lib -) - -FIND_LIBRARY(LUA_LIBRARY_lua - NAMES lua50 lua5.0 lua5 lua + PATH_SUFFIXES lib64 lib PATHS ~/Library/Frameworks /Library/Frameworks @@ -51,7 +41,6 @@ FIND_LIBRARY(LUA_LIBRARY_lua /opt/local /opt/csw /opt - PATH_SUFFIXES lib64 lib ) # In an OS X framework, lualib is usually included as part of the framework @@ -61,15 +50,10 @@ IF(${LUA_LIBRARY_lua} MATCHES "framework") ELSE(${LUA_LIBRARY_lua} MATCHES "framework") FIND_LIBRARY(LUA_LIBRARY_lualib NAMES lualib50 lualib5.0 lualib5 lualib - PATHS + HINTS $ENV{LUALIB_DIR} $ENV{LUA_DIR} - NO_DEFAULT_PATH PATH_SUFFIXES lib64 lib - ) - - FIND_LIBRARY(LUA_LIBRARY_lualib - NAMES lualib50 lualib5.0 lualib5 lualib PATHS /usr/local /usr @@ -77,7 +61,6 @@ ELSE(${LUA_LIBRARY_lua} MATCHES "framework") /opt/local /opt/csw /opt - PATH_SUFFIXES lib64 lib ) IF(LUA_LIBRARY_lualib AND LUA_LIBRARY_lua) # include the math library for Unix diff --git a/Modules/FindLua51.cmake b/Modules/FindLua51.cmake index 0a82e8c663..04d7db62d4 100644 --- a/Modules/FindLua51.cmake +++ b/Modules/FindLua51.cmake @@ -13,13 +13,9 @@ FIND_PATH(LUA_INCLUDE_DIR lua.h - PATHS + HINTS $ENV{LUA_DIR} - NO_DEFAULT_PATH PATH_SUFFIXES include/lua51 include/lua5.1 include/lua include -) - -FIND_PATH(LUA_INCLUDE_DIR lua.h PATHS ~/Library/Frameworks /Library/Frameworks @@ -29,19 +25,13 @@ FIND_PATH(LUA_INCLUDE_DIR lua.h /opt/local # DarwinPorts /opt/csw # Blastwave /opt - PATH_SUFFIXES include/lua51 include/lua5.1 include/lua include ) FIND_LIBRARY(LUA_LIBRARY NAMES lua51 lua5.1 lua - PATHS + HINTS $ENV{LUA_DIR} - NO_DEFAULT_PATH - PATH_SUFFIXES lib64 lib -) - -FIND_LIBRARY(LUA_LIBRARY - NAMES lua51 lua5.1 lua + PATH_SUFFIXES lib64 lib PATHS ~/Library/Frameworks /Library/Frameworks @@ -51,7 +41,6 @@ FIND_LIBRARY(LUA_LIBRARY /opt/local /opt/csw /opt - PATH_SUFFIXES lib64 lib ) IF(LUA_LIBRARY) @@ -68,7 +57,7 @@ ENDIF(LUA_LIBRARY) INCLUDE(FindPackageHandleStandardArgs) # handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if # all listed variables are TRUE -FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua50 DEFAULT_MSG LUA_LIBRARIES LUA_INCLUDE_DIR) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua51 DEFAULT_MSG LUA_LIBRARIES LUA_INCLUDE_DIR) MARK_AS_ADVANCED(LUA_INCLUDE_DIR LUA_LIBRARIES LUA_LIBRARY LUA_MATH_LIBRARY) diff --git a/Modules/FindOpenAL.cmake b/Modules/FindOpenAL.cmake index 8d2933c5f2..d9cb7c1806 100644 --- a/Modules/FindOpenAL.cmake +++ b/Modules/FindOpenAL.cmake @@ -49,13 +49,9 @@ # CMAKE_INCLUDE_PATH to modify the search paths. FIND_PATH(OPENAL_INCLUDE_DIR al.h - PATHS + HINTS $ENV{OPENALDIR} - NO_DEFAULT_PATH PATH_SUFFIXES include/AL include/OpenAL include -) - -FIND_PATH(OPENAL_INCLUDE_DIR al.h PATHS ~/Library/Frameworks /Library/Frameworks @@ -66,19 +62,13 @@ FIND_PATH(OPENAL_INCLUDE_DIR al.h /opt/csw # Blastwave /opt [HKEY_LOCAL_MACHINE\\SOFTWARE\\Creative\ Labs\\OpenAL\ 1.1\ Software\ Development\ Kit\\1.00.0000;InstallDir] - PATH_SUFFIXES include/AL include/OpenAL include ) FIND_LIBRARY(OPENAL_LIBRARY NAMES OpenAL al openal OpenAL32 - PATHS + HINTS $ENV{OPENALDIR} - NO_DEFAULT_PATH - PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64 -) - -FIND_LIBRARY(OPENAL_LIBRARY - NAMES OpenAL al openal OpenAL32 + PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64 PATHS ~/Library/Frameworks /Library/Frameworks @@ -89,7 +79,6 @@ FIND_LIBRARY(OPENAL_LIBRARY /opt/csw /opt [HKEY_LOCAL_MACHINE\\SOFTWARE\\Creative\ Labs\\OpenAL\ 1.1\ Software\ Development\ Kit\\1.00.0000;InstallDir] - PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64 ) diff --git a/Modules/FindOpenThreads.cmake b/Modules/FindOpenThreads.cmake index fc5cd36591..75fdbdd365 100644 --- a/Modules/FindOpenThreads.cmake +++ b/Modules/FindOpenThreads.cmake @@ -39,7 +39,7 @@ # Explicit -DVAR=value arguments should still be able to override everything. FIND_PATH(OPENTHREADS_INCLUDE_DIR OpenThreads/Thread - PATHS + HINTS $ENV{OPENTHREADS_INCLUDE_DIR} $ENV{OPENTHREADS_DIR}/include $ENV{OPENTHREADS_DIR} @@ -48,12 +48,7 @@ FIND_PATH(OPENTHREADS_INCLUDE_DIR OpenThreads/Thread $ENV{OSG_DIR} $ENV{OSGDIR}/include $ENV{OSGDIR} - NO_DEFAULT_PATH -) - - - -FIND_PATH(OPENTHREADS_INCLUDE_DIR OpenThreads/Thread + PATHS ~/Library/Frameworks /Library/Frameworks /usr/local/include @@ -69,7 +64,7 @@ FIND_PATH(OPENTHREADS_INCLUDE_DIR OpenThreads/Thread FIND_LIBRARY(OPENTHREADS_LIBRARY NAMES OpenThreads OpenThreadsWin32 - PATHS + HINTS $ENV{OPENTHREADS_LIBRARY_DIR} $ENV{OPENTHREADS_DIR}/lib64 $ENV{OPENTHREADS_DIR}/lib @@ -81,13 +76,6 @@ FIND_LIBRARY(OPENTHREADS_LIBRARY $ENV{OSGDIR}/lib64 $ENV{OSGDIR}/lib $ENV{OSGDIR} - NO_DEFAULT_PATH -) - - - -FIND_LIBRARY(OPENTHREADS_LIBRARY - NAMES OpenThreads OpenThreadsWin32 PATHS ~/Library/Frameworks /Library/Frameworks @@ -110,7 +98,7 @@ FIND_LIBRARY(OPENTHREADS_LIBRARY FIND_LIBRARY(OPENTHREADS_LIBRARY_DEBUG NAMES OpenThreadsd OpenThreadsWin32d - PATHS + HINTS $ENV{OPENTHREADS_DEBUG_LIBRARY_DIR} $ENV{OPENTHREADS_LIBRARY_DIR} $ENV{OPENTHREADS_DIR}/lib64 @@ -123,13 +111,6 @@ FIND_LIBRARY(OPENTHREADS_LIBRARY_DEBUG $ENV{OSGDIR}/lib64 $ENV{OSGDIR}/lib $ENV{OSGDIR} - NO_DEFAULT_PATH -) - - - -FIND_LIBRARY(OPENTHREADS_LIBRARY_DEBUG - NAMES OpenThreadsd OpenThreadsWin32d PATHS /usr/local/lib64 /usr/local/lib diff --git a/Modules/FindPhysFS.cmake b/Modules/FindPhysFS.cmake index 93e3b9914d..443ce3831d 100644 --- a/Modules/FindPhysFS.cmake +++ b/Modules/FindPhysFS.cmake @@ -11,13 +11,9 @@ # Created by Eric Wing. FIND_PATH(PHYSFS_INCLUDE_DIR physfs.h - PATHS + HINTS $ENV{PHYSFSDIR} - NO_DEFAULT_PATH - PATH_SUFFIXES include -) - -FIND_PATH(PHYSFS_INCLUDE_DIR physfs.h + PATH_SUFFIXES include/physfs include PATHS ~/Library/Frameworks /Library/Frameworks @@ -27,19 +23,13 @@ FIND_PATH(PHYSFS_INCLUDE_DIR physfs.h /opt/local # DarwinPorts /opt/csw # Blastwave /opt - PATH_SUFFIXES include/physfs include ) FIND_LIBRARY(PHYSFS_LIBRARY NAMES physfs - PATHS + HINTS $ENV{PHYSFSDIR} - NO_DEFAULT_PATH - PATH_SUFFIXES lib64 lib -) - -FIND_LIBRARY(PHYSFS_LIBRARY - NAMES physfs + PATH_SUFFIXES lib64 lib PATHS ~/Library/Frameworks /Library/Frameworks @@ -49,7 +39,6 @@ FIND_LIBRARY(PHYSFS_LIBRARY /opt/local /opt/csw /opt - PATH_SUFFIXES lib64 lib ) SET(PHYSFS_FOUND "NO") diff --git a/Modules/FindProducer.cmake b/Modules/FindProducer.cmake index 576eae240f..db51d3a947 100644 --- a/Modules/FindProducer.cmake +++ b/Modules/FindProducer.cmake @@ -30,15 +30,11 @@ # Try the user's environment request before anything else. FIND_PATH(PRODUCER_INCLUDE_DIR Producer/CameraGroup - PATHS + HINTS $ENV{PRODUCER_DIR} $ENV{OSG_DIR} $ENV{OSGDIR} - NO_DEFAULT_PATH PATH_SUFFIXES include -) - -FIND_PATH(PRODUCER_INCLUDE_DIR Producer/CameraGroup PATHS ~/Library/Frameworks /Library/Frameworks @@ -54,16 +50,11 @@ FIND_PATH(PRODUCER_INCLUDE_DIR Producer/CameraGroup FIND_LIBRARY(PRODUCER_LIBRARY NAMES Producer - PATHS + HINTS $ENV{PRODUCER_DIR} $ENV{OSG_DIR} $ENV{OSGDIR} - NO_DEFAULT_PATH - PATH_SUFFIXES lib64 lib -) - -FIND_LIBRARY(PRODUCER_LIBRARY - NAMES Producer + PATH_SUFFIXES lib64 lib PATHS /usr/local /usr @@ -71,7 +62,6 @@ FIND_LIBRARY(PRODUCER_LIBRARY /opt/local /opt/csw /opt - PATH_SUFFIXES lib64 lib ) SET(PRODUCER_FOUND "NO") diff --git a/Modules/FindQt3.cmake b/Modules/FindQt3.cmake index 14c0ac4e3d..658d7ec409 100644 --- a/Modules/FindQt3.cmake +++ b/Modules/FindQt3.cmake @@ -122,13 +122,8 @@ FIND_LIBRARY(QT_QASSISTANTCLIENT_LIBRARY # qt 3 should prefer QTDIR over the PATH FIND_PROGRAM(QT_MOC_EXECUTABLE NAMES moc moc-qt3 - PATHS + HINTS $ENV{QTDIR}/bin - NO_DEFAULT_PATH -) - -FIND_PROGRAM(QT_MOC_EXECUTABLE - NAMES moc moc-qt3 PATHS "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.1;InstallDir]/include/Qt" "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/include/Qt" @@ -150,15 +145,12 @@ ENDIF(QT_MOC_EXECUTABLE) # qt 3 should prefer QTDIR over the PATH FIND_PROGRAM(QT_UIC_EXECUTABLE uic - PATHS + HINTS $ENV{QTDIR}/bin - NO_DEFAULT_PATH -) -FIND_PROGRAM(QT_UIC_EXECUTABLE uic + PATHS "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.1;InstallDir]/include/Qt" "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/include/Qt" "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]/include/Qt" - $ENV{QTDIR}/bin ${GLOB_PATHS_BIN} /usr/local/qt/bin /usr/lib/qt/bin diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake index d07bc0b87e..91983eda83 100644 --- a/Modules/FindQt4.cmake +++ b/Modules/FindQt4.cmake @@ -1021,6 +1021,7 @@ IF (QT4_QMAKE_FOUND) FILE(RELATIVE_PATH rel ${CMAKE_CURRENT_SOURCE_DIR} ${infile}) ENDIF(CMAKE_CURRENT_BINARY_DIR MATCHES "${_checkinfile}") SET(_outfile "${CMAKE_CURRENT_BINARY_DIR}/${rel}") + STRING(REPLACE ".." "__" _outfile ${_outfile}) GET_FILENAME_COMPONENT(outpath ${_outfile} PATH) GET_FILENAME_COMPONENT(_outfile ${_outfile} NAME_WE) FILE(MAKE_DIRECTORY ${outpath}) @@ -1356,6 +1357,13 @@ IF (QT4_QMAKE_FOUND) # configuration/system dependent settings # ############################################### + + # find dependencies for some Qt modules + # when doing builds against a static Qt, they are required + # when doing builds against a shared Qt, they are sometimes not required + # even some Linux distros do not require these dependencies + # if a user needs the dependencies, and they couldn't be found, they can set + # the variables themselves. SET(QT_QTGUI_LIB_DEPENDENCIES "") SET(QT_QTCORE_LIB_DEPENDENCIES "") @@ -1378,8 +1386,10 @@ IF (QT4_QMAKE_FOUND) ## system png IF(QT_QCONFIG MATCHES "system-png") FIND_LIBRARY(QT_PNG_LIBRARY NAMES png) - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_PNG_LIBRARY}) MARK_AS_ADVANCED(QT_PNG_LIBRARY) + IF(QT_PNG_LIBRARY) + SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_PNG_LIBRARY}) + ENDIF(QT_PNG_LIBRARY) ENDIF(QT_QCONFIG MATCHES "system-png") # for X11, get X11 library directory @@ -1392,78 +1402,100 @@ IF (QT4_QMAKE_FOUND) # ask qmake where the x11 libs are FIND_LIBRARY(QT_X11_SM_LIBRARY NAMES SM PATHS ${QMAKE_LIBDIR_X11}) FIND_LIBRARY(QT_X11_ICE_LIBRARY NAMES ICE PATHS ${QMAKE_LIBDIR_X11}) - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_X11_SM_LIBRARY} ${QT_X11_ICE_LIBRARY}) MARK_AS_ADVANCED(QT_X11_SM_LIBRARY) MARK_AS_ADVANCED(QT_X11_ICE_LIBRARY) + IF(QT_X11_SM_LIBRARY AND QT_X11_ICE_LIBRARY) + SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_X11_SM_LIBRARY} ${QT_X11_ICE_LIBRARY}) + ENDIF(QT_X11_SM_LIBRARY AND QT_X11_ICE_LIBRARY) ENDIF(QT_QCONFIG MATCHES "x11sm") ## Xi IF(QT_QCONFIG MATCHES "tablet") FIND_LIBRARY(QT_XI_LIBRARY NAMES Xi PATHS ${QMAKE_LIBDIR_X11}) - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_XI_LIBRARY}) MARK_AS_ADVANCED(QT_XI_LIBRARY) + IF(QT_XI_LIBRARY) + SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_XI_LIBRARY}) + ENDIF(QT_XI_LIBRARY) ENDIF(QT_QCONFIG MATCHES "tablet") ## Xrender IF(QT_QCONFIG MATCHES "xrender") FIND_LIBRARY(QT_XRENDER_LIBRARY NAMES Xrender PATHS ${QMAKE_LIBDIR_X11}) - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_XRENDER_LIBRARY}) MARK_AS_ADVANCED(QT_XRENDER_LIBRARY) + IF(QT_XRENDER_LIBRARY) + SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_XRENDER_LIBRARY}) + ENDIF(QT_XRENDER_LIBRARY) ENDIF(QT_QCONFIG MATCHES "xrender") ## Xrandr IF(QT_QCONFIG MATCHES "xrandr") FIND_LIBRARY(QT_XRANDR_LIBRARY NAMES Xrandr PATHS ${QMAKE_LIBDIR_X11}) - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_XRANDR_LIBRARY}) MARK_AS_ADVANCED(QT_XRANDR_LIBRARY) + IF(QT_XRANDR_LIBRARY) + SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_XRANDR_LIBRARY}) + ENDIF(QT_XRANDR_LIBRARY) ENDIF(QT_QCONFIG MATCHES "xrandr") ## Xcursor IF(QT_QCONFIG MATCHES "xcursor") FIND_LIBRARY(QT_XCURSOR_LIBRARY NAMES Xcursor PATHS ${QMAKE_LIBDIR_X11}) - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_XCURSOR_LIBRARY}) MARK_AS_ADVANCED(QT_XCURSOR_LIBRARY) + IF(QT_XCURSOR_LIBRARY) + SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_XCURSOR_LIBRARY}) + ENDIF(QT_XCURSOR_LIBRARY) ENDIF(QT_QCONFIG MATCHES "xcursor") ## Xinerama IF(QT_QCONFIG MATCHES "xinerama") FIND_LIBRARY(QT_XINERAMA_LIBRARY NAMES Xinerama PATHS ${QMAKE_LIBDIR_X11}) - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_XINERAMA_LIBRARY}) MARK_AS_ADVANCED(QT_XINERAMA_LIBRARY) + IF(QT_XINERAMA_LIBRARY) + SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_XINERAMA_LIBRARY}) + ENDIF(QT_XINERAMA_LIBRARY) ENDIF(QT_QCONFIG MATCHES "xinerama") ## Xfixes IF(QT_QCONFIG MATCHES "xfixes") FIND_LIBRARY(QT_XFIXES_LIBRARY NAMES Xfixes PATHS ${QMAKE_LIBDIR_X11}) - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_XFIXES_LIBRARY}) MARK_AS_ADVANCED(QT_XFIXES_LIBRARY) + IF(QT_XFIXES_LIBRARY) + SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_XFIXES_LIBRARY}) + ENDIF(QT_XFIXES_LIBRARY) ENDIF(QT_QCONFIG MATCHES "xfixes") ## system-freetype IF(QT_QCONFIG MATCHES "system-freetype") FIND_LIBRARY(QT_FREETYPE_LIBRARY NAMES freetype) - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_FREETYPE_LIBRARY}) MARK_AS_ADVANCED(QT_FREETYPE_LIBRARY) + IF(QT_FREETYPE_LIBRARY) + SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_FREETYPE_LIBRARY}) + ENDIF(QT_FREETYPE_LIBRARY) ENDIF(QT_QCONFIG MATCHES "system-freetype") ## fontconfig IF(QT_QCONFIG MATCHES "fontconfig") FIND_LIBRARY(QT_FONTCONFIG_LIBRARY NAMES fontconfig) - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_FONTCONFIG_LIBRARY}) MARK_AS_ADVANCED(QT_FONTCONFIG_LIBRARY) + IF(QT_FONTCONFIG_LIBRARY) + SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_FONTCONFIG_LIBRARY}) + ENDIF(QT_FONTCONFIG_LIBRARY) ENDIF(QT_QCONFIG MATCHES "fontconfig") ## system-zlib IF(QT_QCONFIG MATCHES "system-zlib") FIND_LIBRARY(QT_ZLIB_LIBRARY NAMES z) - SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${QT_ZLIB_LIBRARY}) MARK_AS_ADVANCED(QT_ZLIB_LIBRARY) + IF(QT_ZLIB_LIBRARY) + SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${QT_ZLIB_LIBRARY}) + ENDIF(QT_ZLIB_LIBRARY) ENDIF(QT_QCONFIG MATCHES "system-zlib") ## openssl IF(QT_QCONFIG MATCHES "openssl" AND NOT Q_WS_WIN) FIND_PACKAGE(OpenSSL) - SET(QT_QTNETWORK_LIB_DEPENDENCIES ${QT_QTNETWORK_LIB_DEPENDENCIES} ${OPENSSL_LIBRARIES}) + IF(OPENSSL_LIBRARIES) + SET(QT_QTNETWORK_LIB_DEPENDENCIES ${QT_QTNETWORK_LIB_DEPENDENCIES} ${OPENSSL_LIBRARIES}) + ENDIF(OPENSSL_LIBRARIES) ENDIF(QT_QCONFIG MATCHES "openssl" AND NOT Q_WS_WIN) ## qdbus @@ -1536,8 +1568,10 @@ IF (QT4_QMAKE_FOUND) SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES_SAVE}) IF(QT_POSIX_TIMERS) FIND_LIBRARY(QT_RT_LIBRARY NAMES rt) - SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${QT_RT_LIBRARY}) MARK_AS_ADVANCED(QT_RT_LIBRARY) + IF(QT_RT_LIBRARY) + SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${QT_RT_LIBRARY}) + ENDIF(QT_RT_LIBRARY) ENDIF(QT_POSIX_TIMERS) ENDIF(QT_QCONFIG MATCHES "clock-monotonic") @@ -1549,8 +1583,10 @@ IF (QT4_QMAKE_FOUND) STRING(REGEX REPLACE "-l" "" QT_X11_LIB "${QT_X11_LIB}") SET(QT_TMP_STR "QT_X11_${QT_X11_LIB}_LIBRARY") FIND_LIBRARY(${QT_TMP_STR} NAMES "${QT_X11_LIB}" PATHS ${QMAKE_LIBDIR_X11}) - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${${QT_TMP_STR}}) MARK_AS_ADVANCED(${QT_TMP_STR}) + IF(${QT_TMP_STR}) + SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${${QT_TMP_STR}}) + ENDIF(${QT_TMP_STR}) ENDFOREACH(QT_X11_LIB) QT_QUERY_QMAKE(QT_LIBS_THREAD "QMAKE_LIBS_THREAD") diff --git a/Modules/FindQuickTime.cmake b/Modules/FindQuickTime.cmake index 00bc3ec727..5a4a580a32 100644 --- a/Modules/FindQuickTime.cmake +++ b/Modules/FindQuickTime.cmake @@ -17,20 +17,15 @@ IF(APPLE) FIND_LIBRARY(QUICKTIME_LIBRARY QuickTime) ELSE(APPLE) FIND_PATH(QUICKTIME_INCLUDE_DIR QuickTime.h + HINTS $ENV{QUICKTIME_DIR}/include $ENV{QUICKTIME_DIR} - NO_DEFAULT_PATH ) - - FIND_PATH(QUICKTIME_INCLUDE_DIR QuickTime.h) - FIND_LIBRARY(QUICKTIME_LIBRARY QuickTime + HINTS $ENV{QUICKTIME_DIR}/lib $ENV{QUICKTIME_DIR} - NO_DEFAULT_PATH ) - - FIND_LIBRARY(QUICKTIME_LIBRARY QuickTime) ENDIF(APPLE) SET(QUICKTIME_FOUND "NO") diff --git a/Modules/FindSDL.cmake b/Modules/FindSDL.cmake index 75b42cca0a..ee880a649d 100644 --- a/Modules/FindSDL.cmake +++ b/Modules/FindSDL.cmake @@ -53,13 +53,9 @@ # reasons because not all systems place things in SDL/ (see FreeBSD). FIND_PATH(SDL_INCLUDE_DIR SDL.h - PATHS + HINTS $ENV{SDLDIR} - NO_DEFAULT_PATH PATH_SUFFIXES include -) - -FIND_PATH(SDL_INCLUDE_DIR SDL.h PATHS ~/Library/Frameworks /Library/Frameworks @@ -86,14 +82,9 @@ FIND_PATH(SDL_INCLUDE_DIR SDL.h # don't confuse it for the version number. FIND_LIBRARY(SDL_LIBRARY_TEMP NAMES SDL SDL-1.1 - PATHS + HINTS $ENV{SDLDIR} - NO_DEFAULT_PATH - PATH_SUFFIXES lib64 lib -) - -FIND_LIBRARY(SDL_LIBRARY_TEMP - NAMES SDL SDL-1.1 + PATH_SUFFIXES lib64 lib PATHS /usr/local /usr @@ -101,7 +92,6 @@ FIND_LIBRARY(SDL_LIBRARY_TEMP /opt/local /opt/csw /opt - PATH_SUFFIXES lib64 lib ) #MESSAGE("SDL_LIBRARY_TEMP is ${SDL_LIBRARY_TEMP}") @@ -114,14 +104,9 @@ IF(NOT SDL_BUILDING_LIBRARY) # necessarily need it. FIND_LIBRARY(SDLMAIN_LIBRARY NAMES SDLmain SDLmain-1.1 - PATHS + HINTS $ENV{SDLDIR} - NO_DEFAULT_PATH PATH_SUFFIXES lib64 lib - ) - - FIND_LIBRARY(SDLMAIN_LIBRARY - NAMES SDLmain SDLmain-1.1 PATHS /usr/local /usr @@ -129,7 +114,6 @@ IF(NOT SDL_BUILDING_LIBRARY) /opt/local /opt/csw /opt - PATH_SUFFIXES lib64 lib ) ENDIF(NOT ${SDL_INCLUDE_DIR} MATCHES ".framework") ENDIF(NOT SDL_BUILDING_LIBRARY) diff --git a/Modules/FindSDL_image.cmake b/Modules/FindSDL_image.cmake index e39b3cbc10..e2481e1abc 100644 --- a/Modules/FindSDL_image.cmake +++ b/Modules/FindSDL_image.cmake @@ -13,14 +13,10 @@ # additional Unix paths (FreeBSD, etc). FIND_PATH(SDLIMAGE_INCLUDE_DIR SDL_image.h - PATHS + HINTS $ENV{SDLIMAGEDIR} $ENV{SDLDIR} - NO_DEFAULT_PATH PATH_SUFFIXES include -) - -FIND_PATH(SDLIMAGE_INCLUDE_DIR SDL_image.h PATHS ~/Library/Frameworks /Library/Frameworks @@ -44,15 +40,10 @@ FIND_PATH(SDLIMAGE_INCLUDE_DIR SDL_image.h FIND_LIBRARY(SDLIMAGE_LIBRARY NAMES SDL_image - PATHS + HINTS $ENV{SDLIMAGEDIR} $ENV{SDLDIR} - NO_DEFAULT_PATH - PATH_SUFFIXES lib64 lib -) - -FIND_LIBRARY(SDLIMAGE_LIBRARY - NAMES SDL_image + PATH_SUFFIXES lib64 lib PATHS ~/Library/Frameworks /Library/Frameworks @@ -62,7 +53,6 @@ FIND_LIBRARY(SDLIMAGE_LIBRARY /opt/local /opt/csw /opt - PATH_SUFFIXES lib64 lib ) SET(SDLIMAGE_FOUND "NO") diff --git a/Modules/FindSDL_mixer.cmake b/Modules/FindSDL_mixer.cmake index 59b0f5ace2..720a17a791 100644 --- a/Modules/FindSDL_mixer.cmake +++ b/Modules/FindSDL_mixer.cmake @@ -13,14 +13,10 @@ # additional Unix paths (FreeBSD, etc). FIND_PATH(SDLMIXER_INCLUDE_DIR SDL_mixer.h - PATHS + HINTS $ENV{SDLMIXERDIR} $ENV{SDLDIR} - NO_DEFAULT_PATH PATH_SUFFIXES include -) - -FIND_PATH(SDLMIXER_INCLUDE_DIR SDL_mixer.h PATHS ~/Library/Frameworks /Library/Frameworks @@ -44,15 +40,10 @@ FIND_PATH(SDLMIXER_INCLUDE_DIR SDL_mixer.h FIND_LIBRARY(SDLMIXER_LIBRARY NAMES SDL_mixer - PATHS + HINTS $ENV{SDLMIXERDIR} $ENV{SDLDIR} - NO_DEFAULT_PATH - PATH_SUFFIXES lib64 lib -) - -FIND_LIBRARY(SDLMIXER_LIBRARY - NAMES SDL_mixer + PATH_SUFFIXES lib64 lib PATHS ~/Library/Frameworks /Library/Frameworks @@ -62,7 +53,6 @@ FIND_LIBRARY(SDLMIXER_LIBRARY /opt/local /opt/csw /opt - PATH_SUFFIXES lib64 lib ) SET(SDLMIXER_FOUND "NO") diff --git a/Modules/FindSDL_net.cmake b/Modules/FindSDL_net.cmake index 8d0ce8aed7..6de1946fae 100644 --- a/Modules/FindSDL_net.cmake +++ b/Modules/FindSDL_net.cmake @@ -14,14 +14,10 @@ FIND_PATH(SDLNET_INCLUDE_DIR SDL_net.h - PATHS + HINTS $ENV{SDLNETDIR} $ENV{SDLDIR} - NO_DEFAULT_PATH PATH_SUFFIXES include -) - -FIND_PATH(SDLNET_INCLUDE_DIR SDL_net.h PATHS ~/Library/Frameworks /Library/Frameworks @@ -44,15 +40,10 @@ FIND_PATH(SDLNET_INCLUDE_DIR SDL_net.h ) FIND_LIBRARY(SDLNET_LIBRARY NAMES SDL_net - PATHS + HINTS $ENV{SDLNETDIR} $ENV{SDLDIR} - NO_DEFAULT_PATH - PATH_SUFFIXES lib64 lib -) - -FIND_LIBRARY(SDLNET_LIBRARY - NAMES SDL_net + PATH_SUFFIXES lib64 lib PATHS ~/Library/Frameworks /Library/Frameworks @@ -62,7 +53,6 @@ FIND_LIBRARY(SDLNET_LIBRARY /opt/local /opt/csw /opt - PATH_SUFFIXES lib64 lib ) SET(SDLNET_FOUND "NO") diff --git a/Modules/FindSDL_sound.cmake b/Modules/FindSDL_sound.cmake index 71d7334cee..21d6b1c7d8 100644 --- a/Modules/FindSDL_sound.cmake +++ b/Modules/FindSDL_sound.cmake @@ -62,16 +62,12 @@ MARK_AS_ADVANCED(SDL_SOUND_EXTRAS) # Find SDL_sound.h FIND_PATH(SDL_SOUND_INCLUDE_DIR SDL_sound.h + HINTS $ENV{SDLSOUNDDIR}/include $ENV{SDLSOUNDDIR} $ENV{SDLDIR}/include $ENV{SDLDIR} - NO_DEFAULT_PATH -) -FIND_PATH(SDL_SOUND_INCLUDE_DIR SDL_sound.h - NO_DEFAULT_PATH -) -FIND_PATH(SDL_SOUND_INCLUDE_DIR SDL_sound.h + PATHS /usr/local/include/SDL /usr/include/SDL /usr/local/include/SDL12 @@ -92,11 +88,12 @@ FIND_PATH(SDL_SOUND_INCLUDE_DIR SDL_sound.h FIND_LIBRARY(SDL_SOUND_LIBRARY NAMES SDL_sound - PATHS + HINTS $ENV{SDLSOUNDDIR}/lib $ENV{SDLSOUNDDIR} $ENV{SDLDIR}/lib $ENV{SDLDIR} + PATHS /usr/local/lib /usr/lib /sw/lib diff --git a/Modules/FindSDL_ttf.cmake b/Modules/FindSDL_ttf.cmake index e1113d6367..20d3e5af81 100644 --- a/Modules/FindSDL_ttf.cmake +++ b/Modules/FindSDL_ttf.cmake @@ -12,16 +12,11 @@ # module, but with modifications to recognize OS X frameworks and # additional Unix paths (FreeBSD, etc). - FIND_PATH(SDLTTF_INCLUDE_DIR SDL_ttf.h - PATHS + HINTS $ENV{SDLTTFDIR} $ENV{SDLDIR} - NO_DEFAULT_PATH PATH_SUFFIXES include -) - -FIND_PATH(SDLTTF_INCLUDE_DIR SDL_ttf.h PATHS ~/Library/Frameworks /Library/Frameworks @@ -45,15 +40,9 @@ FIND_PATH(SDLTTF_INCLUDE_DIR SDL_ttf.h FIND_LIBRARY(SDLTTF_LIBRARY NAMES SDL_ttf - PATHS + HINTS $ENV{SDLTTFDIR} $ENV{SDLDIR} - NO_DEFAULT_PATH - PATH_SUFFIXES lib64 lib -) - -FIND_LIBRARY(SDLTTF_LIBRARY - NAMES SDL_ttf PATHS ~/Library/Frameworks /Library/Frameworks diff --git a/Modules/FindTCL.cmake b/Modules/FindTCL.cmake index 3810609b55..568ab0e055 100644 --- a/Modules/FindTCL.cmake +++ b/Modules/FindTCL.cmake @@ -174,22 +174,12 @@ ENDIF(WIN32) FIND_PATH(TCL_INCLUDE_PATH NAMES tcl.h - PATHS ${TCLTK_POSSIBLE_INCLUDE_PATHS} - NO_DEFAULT_PATH - ) -FIND_PATH(TCL_INCLUDE_PATH - NAMES tcl.h - PATHS ${TCLTK_POSSIBLE_INCLUDE_PATHS} + HINTS ${TCLTK_POSSIBLE_INCLUDE_PATHS} ) FIND_PATH(TK_INCLUDE_PATH NAMES tk.h - PATHS ${TCLTK_POSSIBLE_INCLUDE_PATHS} - NO_DEFAULT_PATH - ) -FIND_PATH(TK_INCLUDE_PATH - NAMES tk.h - PATHS ${TCLTK_POSSIBLE_INCLUDE_PATHS} + HINTS ${TCLTK_POSSIBLE_INCLUDE_PATHS} ) # handle the QUIETLY and REQUIRED arguments and set TCL_FOUND to TRUE if diff --git a/Modules/FindTclsh.cmake b/Modules/FindTclsh.cmake index d2cc86bf6f..129c11ac23 100644 --- a/Modules/FindTclsh.cmake +++ b/Modules/FindTclsh.cmake @@ -66,11 +66,7 @@ SET(TCL_TCLSH_NAMES FIND_PROGRAM(TCL_TCLSH NAMES ${TCL_TCLSH_NAMES} - PATHS ${TCLTK_POSSIBLE_BIN_PATHS} NO_DEFAULT_PATH - ) -FIND_PROGRAM(TCL_TCLSH - NAMES ${TCL_TCLSH_NAMES} - PATHS ${TCLTK_POSSIBLE_BIN_PATHS} + HINTS ${TCLTK_POSSIBLE_BIN_PATHS} ) # handle the QUIETLY and REQUIRED arguments and set TIFF_FOUND to TRUE if diff --git a/Modules/FindWish.cmake b/Modules/FindWish.cmake index 86e9c67610..0afd3c963c 100644 --- a/Modules/FindWish.cmake +++ b/Modules/FindWish.cmake @@ -65,11 +65,7 @@ SET(TK_WISH_NAMES FIND_PROGRAM(TK_WISH NAMES ${TK_WISH_NAMES} - PATHS ${TCLTK_POSSIBLE_BIN_PATHS} NO_DEFAULT_PATH - ) -FIND_PROGRAM(TK_WISH - NAMES ${TK_WISH_NAMES} - PATHS ${TCLTK_POSSIBLE_BIN_PATHS} + HINTS ${TCLTK_POSSIBLE_BIN_PATHS} ) MARK_AS_ADVANCED(TK_WISH) diff --git a/Modules/FindXMLRPC.cmake b/Modules/FindXMLRPC.cmake index 2e8f1ad0f7..2eefd2f758 100644 --- a/Modules/FindXMLRPC.cmake +++ b/Modules/FindXMLRPC.cmake @@ -101,10 +101,8 @@ IF(XMLRPC_FOUND) # Look for this library. FIND_LIBRARY(XMLRPC_${name}_LIBRARY NAMES ${name} - PATHS ${XMLRPC_LIBRARY_DIRS} - NO_DEFAULT_PATH + HINTS ${XMLRPC_LIBRARY_DIRS} ) - FIND_LIBRARY(XMLRPC_${name}_LIBRARY NAMES ${name}) MARK_AS_ADVANCED(XMLRPC_${name}_LIBRARY) # If any library is not found then the whole package is not found. diff --git a/Modules/Findosg.cmake b/Modules/Findosg.cmake index 1a4598c8e1..7804baee01 100644 --- a/Modules/Findosg.cmake +++ b/Modules/Findosg.cmake @@ -27,14 +27,10 @@ # Try the user's environment request before anything else. FIND_PATH(OSG_INCLUDE_DIR osg/PositionAttitudeTransform - PATHS + HINTS $ENV{OSG_DIR} $ENV{OSGDIR} - NO_DEFAULT_PATH PATH_SUFFIXES include -) - -FIND_PATH(OSG_INCLUDE_DIR osg/PositionAttitudeTransform PATHS ~/Library/Frameworks /Library/Frameworks @@ -46,20 +42,14 @@ FIND_PATH(OSG_INCLUDE_DIR osg/PositionAttitudeTransform /opt [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT] [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT] - PATH_SUFFIXES include ) FIND_LIBRARY(OSG_LIBRARY NAMES osg - PATHS + HINTS $ENV{OSG_DIR} $ENV{OSGDIR} - NO_DEFAULT_PATH - PATH_SUFFIXES lib64 lib -) - -FIND_LIBRARY(OSG_LIBRARY - NAMES osg + PATH_SUFFIXES lib64 lib PATHS ~/Library/Frameworks /Library/Frameworks @@ -69,7 +59,6 @@ FIND_LIBRARY(OSG_LIBRARY /opt/local /opt/csw /opt - PATH_SUFFIXES lib64 lib ) SET(OSG_FOUND "NO") diff --git a/Modules/FindosgDB.cmake b/Modules/FindosgDB.cmake index 711e5f3668..88da80761a 100644 --- a/Modules/FindosgDB.cmake +++ b/Modules/FindosgDB.cmake @@ -27,15 +27,11 @@ # Try the user's environment request before anything else. FIND_PATH(OSGDB_INCLUDE_DIR osgDB/DatabasePager - PATHS + HINTS $ENV{OSGDB_DIR} $ENV{OSG_DIR} $ENV{OSGDIR} - NO_DEFAULT_PATH PATH_SUFFIXES include -) - -FIND_PATH(OSGDB_INCLUDE_DIR osgDB/DatabasePager PATHS ~/Library/Frameworks /Library/Frameworks @@ -47,21 +43,15 @@ FIND_PATH(OSGDB_INCLUDE_DIR osgDB/DatabasePager /opt [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT] [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT] - PATH_SUFFIXES include ) FIND_LIBRARY(OSGDB_LIBRARY NAMES osgDB - PATHS + HINTS $ENV{OSGDB_DIR} $ENV{OSG_DIR} $ENV{OSGDIR} - NO_DEFAULT_PATH - PATH_SUFFIXES lib64 lib -) - -FIND_LIBRARY(OSGDB_LIBRARY - NAMES osgDB + PATH_SUFFIXES lib64 lib PATHS ~/Library/Frameworks /Library/Frameworks @@ -71,7 +61,6 @@ FIND_LIBRARY(OSGDB_LIBRARY /opt/local /opt/csw /opt - PATH_SUFFIXES lib64 lib ) SET(OSGDB_FOUND "NO") diff --git a/Modules/FindosgFX.cmake b/Modules/FindosgFX.cmake index cc1c3a6925..9b45c3106c 100644 --- a/Modules/FindosgFX.cmake +++ b/Modules/FindosgFX.cmake @@ -27,15 +27,11 @@ # Try the user's environment request before anything else. FIND_PATH(OSGFX_INCLUDE_DIR osgFX/BumpMapping - PATHS + HINTS $ENV{OSGFX_DIR} $ENV{OSG_DIR} $ENV{OSGDIR} - NO_DEFAULT_PATH PATH_SUFFIXES include -) - -FIND_PATH(OSGFX_INCLUDE_DIR osgFX/BumpMapping PATHS ~/Library/Frameworks /Library/Frameworks @@ -47,21 +43,15 @@ FIND_PATH(OSGFX_INCLUDE_DIR osgFX/BumpMapping /opt [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT] [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT] - PATH_SUFFIXES include ) FIND_LIBRARY(OSGFX_LIBRARY NAMES osgFX - PATHS + HINTS $ENV{OSGFX_DIR} $ENV{OSG_DIR} $ENV{OSGDIR} - NO_DEFAULT_PATH - PATH_SUFFIXES lib64 lib -) - -FIND_LIBRARY(OSGFX_LIBRARY - NAMES osgFX + PATH_SUFFIXES lib64 lib PATHS ~/Library/Frameworks /Library/Frameworks @@ -71,7 +61,6 @@ FIND_LIBRARY(OSGFX_LIBRARY /opt/local /opt/csw /opt - PATH_SUFFIXES lib64 lib ) SET(OSGFX_FOUND "NO") diff --git a/Modules/FindosgGA.cmake b/Modules/FindosgGA.cmake index a9dc863b33..c1585d063a 100644 --- a/Modules/FindosgGA.cmake +++ b/Modules/FindosgGA.cmake @@ -27,15 +27,11 @@ # Try the user's environment request before anything else. FIND_PATH(OSGGA_INCLUDE_DIR osgGA/FlightManipulator - PATHS + HINTS $ENV{OSGGA_DIR} $ENV{OSG_DIR} $ENV{OSGDIR} - NO_DEFAULT_PATH PATH_SUFFIXES include -) - -FIND_PATH(OSGGA_INCLUDE_DIR osgGA/FlightManipulator PATHS ~/Library/Frameworks /Library/Frameworks @@ -47,21 +43,15 @@ FIND_PATH(OSGGA_INCLUDE_DIR osgGA/FlightManipulator /opt [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT] [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT] - PATH_SUFFIXES include ) FIND_LIBRARY(OSGGA_LIBRARY NAMES osgGA - PATHS + HINTS $ENV{OSGGA_DIR} $ENV{OSG_DIR} $ENV{OSGDIR} - NO_DEFAULT_PATH - PATH_SUFFIXES lib64 lib -) - -FIND_LIBRARY(OSGGA_LIBRARY - NAMES osgGA + PATH_SUFFIXES lib64 lib PATHS ~/Library/Frameworks /Library/Frameworks @@ -71,7 +61,6 @@ FIND_LIBRARY(OSGGA_LIBRARY /opt/local /opt/csw /opt - PATH_SUFFIXES lib64 lib ) SET(OSGGA_FOUND "NO") diff --git a/Modules/FindosgIntrospection.cmake b/Modules/FindosgIntrospection.cmake index 270f5f8999..cf7ffac2fd 100644 --- a/Modules/FindosgIntrospection.cmake +++ b/Modules/FindosgIntrospection.cmake @@ -27,15 +27,11 @@ # Try the user's environment request before anything else. FIND_PATH(OSGINTROSPECTION_INCLUDE_DIR osgIntrospection/Reflection - PATHS + HINTS $ENV{OSGINTROSPECTION_DIR} $ENV{OSG_DIR} $ENV{OSGDIR} - NO_DEFAULT_PATH PATH_SUFFIXES include -) - -FIND_PATH(OSGINTROSPECTION_INCLUDE_DIR osgIntrospection/Reflection PATHS ~/Library/Frameworks /Library/Frameworks @@ -47,21 +43,15 @@ FIND_PATH(OSGINTROSPECTION_INCLUDE_DIR osgIntrospection/Reflection /opt [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT] [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT] - PATH_SUFFIXES include ) FIND_LIBRARY(OSGINTROSPECTION_LIBRARY NAMES osgIntrospection - PATHS + HINTS $ENV{OSGINTROSPECTION_DIR} $ENV{OSG_DIR} $ENV{OSGDIR} - NO_DEFAULT_PATH - PATH_SUFFIXES lib64 lib -) - -FIND_LIBRARY(OSGINTROSPECTION_LIBRARY - NAMES osgIntrospection + PATH_SUFFIXES lib64 lib PATHS ~/Library/Frameworks /Library/Frameworks @@ -71,7 +61,6 @@ FIND_LIBRARY(OSGINTROSPECTION_LIBRARY /opt/local /opt/csw /opt - PATH_SUFFIXES lib64 lib ) SET(OSGINTROSPECTION_FOUND "NO") diff --git a/Modules/FindosgManipulator.cmake b/Modules/FindosgManipulator.cmake index f76e7272ae..17a6424dc2 100644 --- a/Modules/FindosgManipulator.cmake +++ b/Modules/FindosgManipulator.cmake @@ -27,15 +27,11 @@ # Try the user's environment request before anything else. FIND_PATH(OSGMANIPULATOR_INCLUDE_DIR osgManipulator/TrackballDragger - PATHS + HINTS $ENV{OSGMANIPULATOR_DIR} $ENV{OSG_DIR} $ENV{OSGDIR} - NO_DEFAULT_PATH PATH_SUFFIXES include -) - -FIND_PATH(OSGMANIPULATOR_INCLUDE_DIR osgManipulator/TrackballDragger PATHS ~/Library/Frameworks /Library/Frameworks @@ -47,21 +43,15 @@ FIND_PATH(OSGMANIPULATOR_INCLUDE_DIR osgManipulator/TrackballDragger /opt [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT] [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT] - PATH_SUFFIXES include ) FIND_LIBRARY(OSGMANIPULATOR_LIBRARY NAMES osgManipulator - PATHS + HINTS $ENV{OSGMANIPULATOR_DIR} $ENV{OSG_DIR} $ENV{OSGDIR} - NO_DEFAULT_PATH - PATH_SUFFIXES lib64 lib -) - -FIND_LIBRARY(OSGMANIPULATOR_LIBRARY - NAMES osgManipulator + PATH_SUFFIXES lib64 lib PATHS ~/Library/Frameworks /Library/Frameworks @@ -71,7 +61,6 @@ FIND_LIBRARY(OSGMANIPULATOR_LIBRARY /opt/local /opt/csw /opt - PATH_SUFFIXES lib64 lib ) SET(OSGMANIPULATOR_FOUND "NO") diff --git a/Modules/FindosgParticle.cmake b/Modules/FindosgParticle.cmake index a6b4bf99f2..8514b2ff66 100644 --- a/Modules/FindosgParticle.cmake +++ b/Modules/FindosgParticle.cmake @@ -27,15 +27,11 @@ # Try the user's environment request before anything else. FIND_PATH(OSGPARTICLE_INCLUDE_DIR osgParticle/FireEffect - PATHS + HINTS $ENV{OSGPARTICLE_DIR} $ENV{OSG_DIR} $ENV{OSGDIR} - NO_DEFAULT_PATH PATH_SUFFIXES include -) - -FIND_PATH(OSGPARTICLE_INCLUDE_DIR osgParticle/FireEffect PATHS ~/Library/Frameworks /Library/Frameworks @@ -47,21 +43,15 @@ FIND_PATH(OSGPARTICLE_INCLUDE_DIR osgParticle/FireEffect /opt [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT] [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT] - PATH_SUFFIXES include ) FIND_LIBRARY(OSGPARTICLE_LIBRARY NAMES osgParticle - PATHS + HINTS $ENV{OSGPARTICLE_DIR} $ENV{OSG_DIR} $ENV{OSGDIR} - NO_DEFAULT_PATH - PATH_SUFFIXES lib64 lib -) - -FIND_LIBRARY(OSGPARTICLE_LIBRARY - NAMES osgParticle + PATH_SUFFIXES lib64 lib PATHS ~/Library/Frameworks /Library/Frameworks @@ -71,7 +61,6 @@ FIND_LIBRARY(OSGPARTICLE_LIBRARY /opt/local /opt/csw /opt - PATH_SUFFIXES lib64 lib ) SET(OSGPARTICLE_FOUND "NO") diff --git a/Modules/FindosgProducer.cmake b/Modules/FindosgProducer.cmake index 7ff3292c73..0852527b62 100644 --- a/Modules/FindosgProducer.cmake +++ b/Modules/FindosgProducer.cmake @@ -27,15 +27,11 @@ # Try the user's environment request before anything else. FIND_PATH(OSGPRODUCER_INCLUDE_DIR osgProducer/OsgSceneHandler - PATHS + HINTS $ENV{OSGPRODUCER_DIR} $ENV{OSG_DIR} $ENV{OSGDIR} - NO_DEFAULT_PATH PATH_SUFFIXES include -) - -FIND_PATH(OSGPRODUCER_INCLUDE_DIR osgProducer/OsgSceneHandler PATHS ~/Library/Frameworks /Library/Frameworks @@ -47,21 +43,15 @@ FIND_PATH(OSGPRODUCER_INCLUDE_DIR osgProducer/OsgSceneHandler /opt [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT] [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT] - PATH_SUFFIXES include ) FIND_LIBRARY(OSGPRODUCER_LIBRARY NAMES osgProducer - PATHS + HINTS $ENV{OSGPRODUCER_DIR} $ENV{OSG_DIR} $ENV{OSGDIR} - NO_DEFAULT_PATH - PATH_SUFFIXES lib64 lib -) - -FIND_LIBRARY(OSGPRODUCER_LIBRARY - NAMES osgProducer + PATH_SUFFIXES lib64 lib PATHS ~/Library/Frameworks /Library/Frameworks @@ -71,7 +61,6 @@ FIND_LIBRARY(OSGPRODUCER_LIBRARY /opt/local /opt/csw /opt - PATH_SUFFIXES lib64 lib ) SET(OSGPRODUCER_FOUND "NO") diff --git a/Modules/FindosgShadow.cmake b/Modules/FindosgShadow.cmake index 65a2336bea..ddb59fb917 100644 --- a/Modules/FindosgShadow.cmake +++ b/Modules/FindosgShadow.cmake @@ -27,15 +27,11 @@ # Try the user's environment request before anything else. FIND_PATH(OSGSHADOW_INCLUDE_DIR osgShadow/ShadowTexture - PATHS + HINTS $ENV{OSGSHADOW_DIR} $ENV{OSG_DIR} $ENV{OSGDIR} - NO_DEFAULT_PATH PATH_SUFFIXES include -) - -FIND_PATH(OSGSHADOW_INCLUDE_DIR osgShadow/ShadowTexture PATHS ~/Library/Frameworks /Library/Frameworks @@ -47,21 +43,15 @@ FIND_PATH(OSGSHADOW_INCLUDE_DIR osgShadow/ShadowTexture /opt [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT] [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT] - PATH_SUFFIXES include ) FIND_LIBRARY(OSGSHADOW_LIBRARY NAMES osgShadow - PATHS + HINTS $ENV{OSGSHADOW_DIR} $ENV{OSG_DIR} $ENV{OSGDIR} - NO_DEFAULT_PATH - PATH_SUFFIXES lib64 lib -) - -FIND_LIBRARY(OSGSHADOW_LIBRARY - NAMES osgShadow + PATH_SUFFIXES lib64 lib PATHS ~/Library/Frameworks /Library/Frameworks @@ -71,7 +61,6 @@ FIND_LIBRARY(OSGSHADOW_LIBRARY /opt/local /opt/csw /opt - PATH_SUFFIXES lib64 lib ) SET(OSGSHADOW_FOUND "NO") diff --git a/Modules/FindosgSim.cmake b/Modules/FindosgSim.cmake index 4bff3281a1..1293af7cdb 100644 --- a/Modules/FindosgSim.cmake +++ b/Modules/FindosgSim.cmake @@ -27,15 +27,11 @@ # Try the user's environment request before anything else. FIND_PATH(OSGSIM_INCLUDE_DIR osgSim/ImpostorSprite - PATHS + HINTS $ENV{OSGSIM_DIR} $ENV{OSG_DIR} $ENV{OSGDIR} - NO_DEFAULT_PATH PATH_SUFFIXES include -) - -FIND_PATH(OSGSIM_INCLUDE_DIR osgSim/ImpostorSprite PATHS ~/Library/Frameworks /Library/Frameworks @@ -47,21 +43,15 @@ FIND_PATH(OSGSIM_INCLUDE_DIR osgSim/ImpostorSprite /opt [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT] [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT] - PATH_SUFFIXES include ) FIND_LIBRARY(OSGSIM_LIBRARY NAMES osgSim - PATHS + HINTS $ENV{OSGSIM_DIR} $ENV{OSG_DIR} $ENV{OSGDIR} - NO_DEFAULT_PATH - PATH_SUFFIXES lib64 lib -) - -FIND_LIBRARY(OSGSIM_LIBRARY - NAMES osgSim + PATH_SUFFIXES lib64 lib PATHS ~/Library/Frameworks /Library/Frameworks @@ -71,7 +61,6 @@ FIND_LIBRARY(OSGSIM_LIBRARY /opt/local /opt/csw /opt - PATH_SUFFIXES lib64 lib ) SET(OSGSIM_FOUND "NO") diff --git a/Modules/FindosgTerrain.cmake b/Modules/FindosgTerrain.cmake index fcf74896e0..3f3a559d74 100644 --- a/Modules/FindosgTerrain.cmake +++ b/Modules/FindosgTerrain.cmake @@ -27,15 +27,11 @@ # Try the user's environment request before anything else. FIND_PATH(OSGTERRAIN_INCLUDE_DIR osgTerrain/Terrain - PATHS + HINTS $ENV{OSGTERRAIN_DIR} $ENV{OSG_DIR} $ENV{OSGDIR} - NO_DEFAULT_PATH PATH_SUFFIXES include -) - -FIND_PATH(OSGTERRAIN_INCLUDE_DIR osgTerrain/Terrain PATHS ~/Library/Frameworks /Library/Frameworks @@ -47,21 +43,15 @@ FIND_PATH(OSGTERRAIN_INCLUDE_DIR osgTerrain/Terrain /opt [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT] [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT] - PATH_SUFFIXES include ) FIND_LIBRARY(OSGTERRAIN_LIBRARY NAMES osgTerrain - PATHS + HINTS $ENV{OSGTERRAIN_DIR} $ENV{OSG_DIR} $ENV{OSGDIR} - NO_DEFAULT_PATH - PATH_SUFFIXES lib64 lib -) - -FIND_LIBRARY(OSGTERRAIN_LIBRARY - NAMES osgTerrain + PATH_SUFFIXES lib64 lib PATHS ~/Library/Frameworks /Library/Frameworks @@ -71,7 +61,6 @@ FIND_LIBRARY(OSGTERRAIN_LIBRARY /opt/local /opt/csw /opt - PATH_SUFFIXES lib64 lib ) SET(OSGTERRAIN_FOUND "NO") diff --git a/Modules/FindosgText.cmake b/Modules/FindosgText.cmake index d6c3e1f25f..7eef2a1c51 100644 --- a/Modules/FindosgText.cmake +++ b/Modules/FindosgText.cmake @@ -27,15 +27,11 @@ # Try the user's environment request before anything else. FIND_PATH(OSGTEXT_INCLUDE_DIR osgText/Text - PATHS + HINTS $ENV{OSGTEXT_DIR} $ENV{OSG_DIR} $ENV{OSGDIR} - NO_DEFAULT_PATH PATH_SUFFIXES include -) - -FIND_PATH(OSGTEXT_INCLUDE_DIR osgText/Text PATHS ~/Library/Frameworks /Library/Frameworks @@ -47,21 +43,15 @@ FIND_PATH(OSGTEXT_INCLUDE_DIR osgText/Text /opt [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT] [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT] - PATH_SUFFIXES include ) FIND_LIBRARY(OSGTEXT_LIBRARY NAMES osgText - PATHS + HINTS $ENV{OSGTEXT_DIR} $ENV{OSG_DIR} $ENV{OSGDIR} - NO_DEFAULT_PATH - PATH_SUFFIXES lib64 lib -) - -FIND_LIBRARY(OSGTEXT_LIBRARY - NAMES osgText + PATH_SUFFIXES lib64 lib PATHS ~/Library/Frameworks /Library/Frameworks @@ -71,7 +61,6 @@ FIND_LIBRARY(OSGTEXT_LIBRARY /opt/local /opt/csw /opt - PATH_SUFFIXES lib64 lib ) SET(OSGTEXT_FOUND "NO") diff --git a/Modules/FindosgUtil.cmake b/Modules/FindosgUtil.cmake index cbd9b8c0c9..f73d82bd3a 100644 --- a/Modules/FindosgUtil.cmake +++ b/Modules/FindosgUtil.cmake @@ -27,15 +27,11 @@ # Try the user's environment request before anything else. FIND_PATH(OSGUTIL_INCLUDE_DIR osgUtil/SceneView - PATHS + HINTS $ENV{OSGUTIL_DIR} $ENV{OSG_DIR} $ENV{OSGDIR} - NO_DEFAULT_PATH PATH_SUFFIXES include -) - -FIND_PATH(OSGUTIL_INCLUDE_DIR osgUtil/SceneView PATHS ~/Library/Frameworks /Library/Frameworks @@ -47,21 +43,15 @@ FIND_PATH(OSGUTIL_INCLUDE_DIR osgUtil/SceneView /opt [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT] [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT] - PATH_SUFFIXES include ) FIND_LIBRARY(OSGUTIL_LIBRARY NAMES osgUtil - PATHS + HINTS $ENV{OSGUTIL_DIR} $ENV{OSG_DIR} $ENV{OSGDIR} - NO_DEFAULT_PATH - PATH_SUFFIXES lib64 lib -) - -FIND_LIBRARY(OSGUTIL_LIBRARY - NAMES osgUtil + PATH_SUFFIXES lib64 lib PATHS ~/Library/Frameworks /Library/Frameworks @@ -71,7 +61,6 @@ FIND_LIBRARY(OSGUTIL_LIBRARY /opt/local /opt/csw /opt - PATH_SUFFIXES lib64 lib ) SET(OSGUTIL_FOUND "NO") diff --git a/Modules/FindosgViewer.cmake b/Modules/FindosgViewer.cmake index b9efd47ef6..d240a8c03d 100644 --- a/Modules/FindosgViewer.cmake +++ b/Modules/FindosgViewer.cmake @@ -27,15 +27,11 @@ # Try the user's environment request before anything else. FIND_PATH(OSGVIEWER_INCLUDE_DIR osgViewer/Viewer - PATHS + HINTS $ENV{OSGVIEWER_DIR} $ENV{OSG_DIR} $ENV{OSGDIR} - NO_DEFAULT_PATH PATH_SUFFIXES include -) - -FIND_PATH(OSGVIEWER_INCLUDE_DIR osgViewer/Viewer PATHS ~/Library/Frameworks /Library/Frameworks @@ -47,21 +43,15 @@ FIND_PATH(OSGVIEWER_INCLUDE_DIR osgViewer/Viewer /opt [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT] [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT] - PATH_SUFFIXES include ) FIND_LIBRARY(OSGVIEWER_LIBRARY NAMES osgViewer - PATHS + HINTS $ENV{OSGVIEWER_DIR} $ENV{OSG_DIR} $ENV{OSGDIR} - NO_DEFAULT_PATH - PATH_SUFFIXES lib64 lib -) - -FIND_LIBRARY(OSGVIEWER_LIBRARY - NAMES osgViewer + PATH_SUFFIXES lib64 lib PATHS ~/Library/Frameworks /Library/Frameworks @@ -71,7 +61,6 @@ FIND_LIBRARY(OSGVIEWER_LIBRARY /opt/local /opt/csw /opt - PATH_SUFFIXES lib64 lib ) SET(OSGVIEWER_FOUND "NO") diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 9a6792e4c7..7a3086e80f 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -1165,7 +1165,7 @@ std::string cmCTestTestHandler::FindTheExecutable(const char *exe) failedPaths); } -// add additional configuraitons to the search path +// add additional configurations to the search path void cmCTestTestHandler ::AddConfigurations(cmCTest *ctest, std::vector<std::string> &attempted, @@ -1175,7 +1175,8 @@ void cmCTestTestHandler { std::string tempPath; - if (filepath.size()) + if (filepath.size() && + filepath[filepath.size()-1] != '/') { filepath += "/"; } @@ -1259,6 +1260,16 @@ std::string cmCTestTestHandler attemptedConfigs, filepath,filename); + // even if a fullpath was specified also try it relative to the current directory + if (filepath.size() && filepath[0] == '/') + { + std::string localfilepath = filepath.substr(1,filepath.size()-1); + cmCTestTestHandler::AddConfigurations(ctest, attempted, + attemptedConfigs, + localfilepath,filename); + } + + // if extraPaths are provided and we were not passed a full path, try them, // try any extra paths if (filepath.size() == 0) @@ -1274,8 +1285,8 @@ std::string cmCTestTestHandler filepathExtra, filenameExtra); } - } - + } + // store the final location in fullPath std::string fullPath; diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx index afbdc70c4f..5912a79f0e 100644 --- a/Source/cmAddCustomCommandCommand.cxx +++ b/Source/cmAddCustomCommandCommand.cxx @@ -40,7 +40,6 @@ bool cmAddCustomCommandCommand std::vector<std::string> depends, outputs, output; bool verbatim = false; bool append = false; - bool skip_rule_depends = false; std::string implicit_depends_lang; cmCustomCommand::ImplicitDependsList implicit_depends; @@ -104,11 +103,6 @@ bool cmAddCustomCommandCommand { verbatim = true; } - else if(copy == "SKIP_RULE_DEPENDS") - { - doing = doing_nothing; - skip_rule_depends = true; - } else if(copy == "APPEND") { append = true; @@ -316,8 +310,8 @@ bool cmAddCustomCommandCommand working.c_str(), false, escapeOldStyle); - // Get the rule object to add some extra information. - if(!implicit_depends.empty() || skip_rule_depends) + // Add implicit dependency scanning requests if any were given. + if(!implicit_depends.empty()) { bool okay = false; if(cmSourceFile* sf = @@ -326,16 +320,7 @@ bool cmAddCustomCommandCommand if(cmCustomCommand* cc = sf->GetCustomCommand()) { okay = true; - - // Add implicit dependency scanning requests if any were - // given. - if(!implicit_depends.empty()) - { - cc->SetImplicitDepends(implicit_depends); - } - - // Set the rule dependency state. - cc->SetSkipRuleDepends(skip_rule_depends); + cc->SetImplicitDepends(implicit_depends); } } if(!okay) diff --git a/Source/cmAddCustomCommandCommand.h b/Source/cmAddCustomCommandCommand.h index b58a3982f2..7829b61753 100644 --- a/Source/cmAddCustomCommandCommand.h +++ b/Source/cmAddCustomCommandCommand.h @@ -71,7 +71,7 @@ public: " COMMAND command1 [ARGS] [args1...]\n" " [COMMAND command2 [ARGS] [args2...] ...]\n" " [MAIN_DEPENDENCY depend]\n" - " [DEPENDS [depends...]] [SKIP_RULE_DEPENDS]\n" + " [DEPENDS [depends...]]\n" " [IMPLICIT_DEPENDS <lang1> depend1 ...]\n" " [WORKING_DIRECTORY dir]\n" " [COMMENT comment] [VERBATIM] [APPEND])\n" @@ -134,12 +134,6 @@ public: "created as a file on disk it should be marked as SYMBOLIC with " "SET_SOURCE_FILES_PROPERTIES.\n" - "The SKIP_RULE_DEPENDS option prevents the custom build rule from " - "having a dependency on itself. This prevents the rule from running " - "again just because the command changed but is useful to create " - "rules that have absolutely no dependencies. Such rules run only " - "when the output file is missing.\n" - "The IMPLICIT_DEPENDS option requests scanning of implicit " "dependencies of an input file. The language given specifies the " "programming language whose corresponding dependency scanner should " diff --git a/Source/cmCustomCommand.cxx b/Source/cmCustomCommand.cxx index b2f5c87f77..60896b1393 100644 --- a/Source/cmCustomCommand.cxx +++ b/Source/cmCustomCommand.cxx @@ -22,7 +22,6 @@ cmCustomCommand::cmCustomCommand() this->HaveComment = false; this->EscapeOldStyle = true; this->EscapeAllowMakeVars = false; - this->SkipRuleDepends = false; } //---------------------------------------------------------------------------- @@ -51,9 +50,10 @@ cmCustomCommand::cmCustomCommand(const std::vector<std::string>& outputs, Comment(comment?comment:""), WorkingDirectory(workingDirectory?workingDirectory:""), EscapeAllowMakeVars(false), - EscapeOldStyle(true), - SkipRuleDepends(false) + EscapeOldStyle(true) { + this->EscapeOldStyle = true; + this->EscapeAllowMakeVars = false; } //---------------------------------------------------------------------------- @@ -136,18 +136,6 @@ void cmCustomCommand::SetEscapeAllowMakeVars(bool b) } //---------------------------------------------------------------------------- -bool cmCustomCommand::GetSkipRuleDepends() const -{ - return this->SkipRuleDepends; -} - -//---------------------------------------------------------------------------- -void cmCustomCommand::SetSkipRuleDepends(bool b) -{ - this->SkipRuleDepends = b; -} - -//---------------------------------------------------------------------------- cmCustomCommand::ImplicitDependsList const& cmCustomCommand::GetImplicitDepends() const { diff --git a/Source/cmCustomCommand.h b/Source/cmCustomCommand.h index c6ad772d3a..70319e587b 100644 --- a/Source/cmCustomCommand.h +++ b/Source/cmCustomCommand.h @@ -68,10 +68,6 @@ public: bool GetEscapeAllowMakeVars() const; void SetEscapeAllowMakeVars(bool b); - /** Set/Get whether to skip the dependency on the rule itself. */ - bool GetSkipRuleDepends() const; - void SetSkipRuleDepends(bool b); - typedef std::pair<cmStdString, cmStdString> ImplicitDependsPair; class ImplicitDependsList: public std::vector<ImplicitDependsPair> {}; void SetImplicitDepends(ImplicitDependsList const&); @@ -87,7 +83,6 @@ private: std::string WorkingDirectory; bool EscapeAllowMakeVars; bool EscapeOldStyle; - bool SkipRuleDepends; ImplicitDependsList ImplicitDepends; }; diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index 8d519bc271..5d58783ff5 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -30,6 +30,7 @@ cmFindBase::cmFindBase() " FIND_XXX(\n" " <VAR>\n" " name | NAMES name1 [name2 ...]\n" + " [HINTS path1 [path2 ... ENV var]]\n" " [PATHS path1 [path2 ... ENV var]]\n" " [PATH_SUFFIXES suffix1 [suffix2 ...]]\n" " [DOC \"cache documentation string\"]\n" @@ -55,7 +56,7 @@ cmFindBase::cmFindBase() "is searched for is specified by the names listed " "after the NAMES argument. Additional search locations " "can be specified after the PATHS argument. If ENV var is " - "found in the PATHS section the environment variable var " + "found in the HINTS or PATHS section the environment variable var " "will be read and converted from a system environment variable to " "a cmake style list of paths. For example ENV PATH would be a way " "to list the system path variable. The argument " @@ -65,33 +66,35 @@ cmFindBase::cmFindBase() "If NO_DEFAULT_PATH is specified, then no additional paths are " "added to the search. " "If NO_DEFAULT_PATH is not specified, the search process is as follows:\n" - "1. Search cmake specific environment variables. This " - "can be skipped if NO_CMAKE_ENVIRONMENT_PATH is passed.\n" - "" + "1. Search paths specified in cmake-specific cache variables. " + "These are intended to be used on the command line with a -DVAR=value. " + "This can be skipped if NO_CMAKE_PATH is passed.\n" " <prefix>/XXX_SUBDIR for each <prefix> in CMAKE_PREFIX_PATH\n" " CMAKE_XXX_PATH\n" " CMAKE_XXX_MAC_PATH\n" - "2. Search cmake variables with the same names as " - "the cmake specific environment variables. These " - "are intended to be used on the command line with a " - "-DVAR=value. This can be skipped if NO_CMAKE_PATH " - "is passed.\n" - "" + "2. Search paths specified in cmake-specific environment variables. " + "These are intended to be set in the user's shell configuration. " + "This can be skipped if NO_CMAKE_ENVIRONMENT_PATH is passed.\n" " <prefix>/XXX_SUBDIR for each <prefix> in CMAKE_PREFIX_PATH\n" " CMAKE_XXX_PATH\n" " CMAKE_XXX_MAC_PATH\n" - "3. Search the standard system environment variables. " + "3. Search the paths specified by the HINTS option. " + "These should be paths computed by system introspection, such as a " + "hint provided by the location of another item already found. " + "Hard-coded guesses should be specified with the PATHS option.\n" + "4. Search the standard system environment variables. " "This can be skipped if NO_SYSTEM_ENVIRONMENT_PATH is an argument.\n" " PATH\n" " XXX_SYSTEM\n" // replace with "", LIB, or INCLUDE - "4. Search cmake variables defined in the Platform files " + "5. Search cmake variables defined in the Platform files " "for the current system. This can be skipped if NO_CMAKE_SYSTEM_PATH " "is passed.\n" " <prefix>/XXX_SUBDIR for each <prefix> in CMAKE_SYSTEM_PREFIX_PATH\n" " CMAKE_SYSTEM_XXX_PATH\n" " CMAKE_SYSTEM_XXX_MAC_PATH\n" - "5. Search the paths specified after PATHS or in the short-hand version " - "of the command.\n" + "6. Search the paths specified by the PATHS option " + "or in the short-hand version of the command. " + "These are typically hard-coded guesses.\n" ; this->GenericDocumentation += this->GenericDocumentationMacPolicy; this->GenericDocumentation += this->GenericDocumentationRootPath; @@ -161,65 +164,61 @@ bool cmFindBase::ParseArguments(std::vector<std::string> const& argsIn) // Find the current bundle/framework search policy. this->SelectDefaultMacMode(); - std::vector<std::string> userPaths; - std::string doc; - bool doingNames = true; // assume it starts with a name - bool doingPaths = false; - bool doingPathSuf = false; bool newStyle = false; - + enum Doing { DoingNone, DoingNames, DoingPaths, DoingPathSuffixes, + DoingHints }; + Doing doing = DoingNames; // assume it starts with a name for (unsigned int j = 1; j < args.size(); ++j) { if(args[j] == "NAMES") { - doingNames = true; + doing = DoingNames; newStyle = true; - doingPathSuf = false; - doingPaths = false; } else if (args[j] == "PATHS") { - doingPaths = true; + doing = DoingPaths; + newStyle = true; + } + else if (args[j] == "HINTS") + { + doing = DoingHints; newStyle = true; - doingNames = false; - doingPathSuf = false; } else if (args[j] == "PATH_SUFFIXES") { + doing = DoingPathSuffixes; compatibility = false; - doingPathSuf = true; newStyle = true; - doingNames = false; - doingPaths = false; } else if (args[j] == "NO_SYSTEM_PATH") { - doingPaths = false; - doingPathSuf = false; - doingNames = false; + doing = DoingNone; this->NoDefaultPath = true; } else if (this->CheckCommonArgument(args[j])) { + doing = DoingNone; compatibility = false; - doingPaths = false; - doingPathSuf = false; - doingNames = false; + // Some common arguments were accidentally supported by CMake + // 2.4 and 2.6.0 in the short-hand form of the command, so we + // must support it even though it is not documented. } - else + else if(doing == DoingNames) { - if(doingNames) - { - this->Names.push_back(args[j]); - } - else if(doingPaths) - { - userPaths.push_back(args[j]); - } - else if(doingPathSuf) - { - this->AddPathSuffix(args[j]); - } + this->Names.push_back(args[j]); + } + else if(doing == DoingPaths) + { + this->AddUserPath(args[j], this->UserPaths); + } + else if(doing == DoingHints) + { + this->AddUserPath(args[j], this->UserHints); + } + else if(doing == DoingPathSuffixes) + { + this->AddPathSuffix(args[j]); } } @@ -262,96 +261,42 @@ bool cmFindBase::ParseArguments(std::vector<std::string> const& argsIn) // FIND_*(VAR name path1 path2 ...) if(!newStyle) { + // All the short-hand arguments have been recorded as names. + std::vector<std::string> shortArgs = this->Names; this->Names.clear(); // clear out any values in Names - this->Names.push_back(args[1]); - for(unsigned int j = 2; j < args.size(); ++j) + this->Names.push_back(shortArgs[0]); + for(unsigned int j = 1; j < shortArgs.size(); ++j) { - userPaths.push_back(args[j]); + this->AddUserPath(shortArgs[j], this->UserPaths); } } - this->ExpandPaths(userPaths); + this->ExpandPaths(); // Handle search root stuff. this->RerootPaths(this->SearchPaths); + + // Add a trailing slash to all prefixes to aid the search process. + this->AddTrailingSlashes(this->SearchPaths); + return true; } -void cmFindBase::ExpandPaths(std::vector<std::string> userPaths) +void cmFindBase::ExpandPaths() { - // if NO Default paths was not specified add the - // standard search paths. - if(!this->NoDefaultPath) - { - if(this->SearchFrameworkFirst || this->SearchFrameworkOnly) - { - this->AddFrameWorkPaths(); - } - if(this->SearchAppBundleFirst || this->SearchAppBundleOnly) - { - this->AddAppBundlePaths(); - } - if(!this->NoCMakeEnvironmentPath && - !(this->SearchFrameworkOnly || this->SearchAppBundleOnly)) - { - // Add CMAKE_*_PATH environment variables - this->AddEnvironmentVariables(); - } - if(!this->NoCMakePath && - !(this->SearchFrameworkOnly || this->SearchAppBundleOnly)) - { - // Add CMake varibles of the same name as the previous environment - // varibles CMAKE_*_PATH to be used most of the time with -D - // command line options - this->AddCMakeVariables(); - } - if(!this->NoSystemEnvironmentPath && - !(this->SearchFrameworkOnly || this->SearchAppBundleOnly)) - { - // add System environment PATH and (LIB or INCLUDE) - this->AddSystemEnvironmentVariables(); - } - if(!this->NoCMakeSystemPath && - !(this->SearchFrameworkOnly || this->SearchAppBundleOnly)) - { - // Add CMAKE_SYSTEM_*_PATH variables which are defined in platform files - this->AddCMakeSystemVariables(); - } - if(this->SearchAppBundleLast) - { - this->AddAppBundlePaths(); - } - if(this->SearchFrameworkLast) - { - this->AddFrameWorkPaths(); - } - } - std::vector<std::string> paths; - // add the paths specified in the FIND_* call - for(unsigned int i =0; i < userPaths.size(); ++i) - { - paths.push_back(userPaths[i]); - } - this->AddPaths(paths); -} + this->AddCMakeVariablePath(); + this->AddCMakeEnvironmentPath(); + this->AddUserHintsPath(); + this->AddSystemEnvironmentPath(); + this->AddCMakeSystemVariablePath(); + this->AddUserGuessPath(); -//---------------------------------------------------------------------------- -void cmFindBase::AddEnvironmentVariables() -{ - std::vector<std::string> paths; - - std::vector<std::string> prefixPaths; - cmSystemTools::GetPath(prefixPaths, "CMAKE_PREFIX_PATH"); - this->AddFindPrefix(paths, prefixPaths); - - std::string var = "CMAKE_"; - var += this->CMakePathName; - var += "_PATH"; - cmSystemTools::GetPath(paths, var.c_str()); - this->AddPaths(paths); + // Add suffixes and clean up paths. + this->AddPathSuffixes(); } -void cmFindBase::AddFindPrefix(std::vector<std::string>& dest, - const std::vector<std::string>& src) +//---------------------------------------------------------------------------- +void cmFindBase::AddPrefixPaths(std::vector<std::string> const& in_paths, + PathType pathType) { // default for programs std::string subdir = "bin"; @@ -369,9 +314,8 @@ void cmFindBase::AddFindPrefix(std::vector<std::string>& dest, subdir = ""; // ? what to do for frameworks ? } - for (std::vector<std::string>::const_iterator it = src.begin(); - it != src.end(); - ++it) + for(std::vector<std::string>::const_iterator it = in_paths.begin(); + it != in_paths.end(); ++it) { std::string dir = it->c_str(); if(!subdir.empty() && !dir.empty() && dir[dir.size()-1] != '/') @@ -381,141 +325,143 @@ void cmFindBase::AddFindPrefix(std::vector<std::string>& dest, std::string add = dir + subdir; if(add != "/") { - dest.push_back(add); + this->AddPathInternal(add, pathType); } if (subdir == "bin") { - dest.push_back(dir + "sbin"); + this->AddPathInternal(dir+"sbin", pathType); } if(!subdir.empty() && *it != "/") { - dest.push_back(*it); + this->AddPathInternal(*it, pathType); } } } -void cmFindBase::AddFrameWorkPaths() +//---------------------------------------------------------------------------- +void cmFindBase::AddCMakePrefixPath(const char* variable) { - std::vector<std::string> paths; - this->GetFrameworkPaths(paths); - this->AddPaths(paths); + // Get a path from a CMake variable. + if(const char* varPath = this->Makefile->GetDefinition(variable)) + { + std::vector<std::string> tmp; + cmSystemTools::ExpandListArgument(varPath, tmp); + this->AddPrefixPaths(tmp, CMakePath); + } } -void cmFindBase::AddPaths(std::vector<std::string> & paths) +//---------------------------------------------------------------------------- +void cmFindBase::AddEnvPrefixPath(const char* variable) { - // add suffixes and clean up paths - this->ExpandRegistryAndCleanPath(paths); - // add the paths to the search paths - this->SearchPaths.insert(this->SearchPaths.end(), - paths.begin(), - paths.end()); + // Get a path from the environment. + std::vector<std::string> tmp; + cmSystemTools::GetPath(tmp, variable); + this->AddPrefixPaths(tmp, EnvPath); } -void cmFindBase::AddAppBundlePaths() +//---------------------------------------------------------------------------- +void cmFindBase::AddCMakeEnvironmentPath() { - std::vector<std::string> paths; - this->GetAppBundlePaths(paths); - this->AddPaths(paths); -} - -void cmFindBase::AddCMakeVariables() -{ - std::string var = "CMAKE_"; - var += this->CMakePathName; - var += "_PATH"; - std::vector<std::string> paths; - - if(const char* prefixPath = - this->Makefile->GetDefinition("CMAKE_PREFIX_PATH")) + if(!this->NoCMakeEnvironmentPath && !this->NoDefaultPath) { - std::vector<std::string> prefixPaths; - cmSystemTools::ExpandListArgument(prefixPath, prefixPaths); - this->AddFindPrefix(paths, prefixPaths); - } + // Add CMAKE_*_PATH environment variables + std::string var = "CMAKE_"; + var += this->CMakePathName; + var += "_PATH"; + this->AddEnvPrefixPath("CMAKE_PREFIX_PATH"); + this->AddEnvPath(var.c_str()); - if(const char* path = this->Makefile->GetDefinition(var.c_str())) - { - cmSystemTools::ExpandListArgument(path, paths); - } - this->AddPaths(paths); + if(this->CMakePathName == "PROGRAM") + { + this->AddEnvPath("CMAKE_APPBUNDLE_PATH"); + } + else + { + this->AddEnvPath("CMAKE_FRAMEWORK_PATH"); + } + } } -void cmFindBase::AddSystemEnvironmentVariables() +//---------------------------------------------------------------------------- +void cmFindBase::AddCMakeVariablePath() { - // Add LIB or INCLUDE - std::vector<std::string> paths; - if(this->EnvironmentPath.size()) + if(!this->NoCMakePath && !this->NoDefaultPath) { - cmSystemTools::GetPath(paths, this->EnvironmentPath.c_str()); + // Add CMake varibles of the same name as the previous environment + // varibles CMAKE_*_PATH to be used most of the time with -D + // command line options + std::string var = "CMAKE_"; + var += this->CMakePathName; + var += "_PATH"; + this->AddCMakePrefixPath("CMAKE_PREFIX_PATH"); + this->AddCMakePath(var.c_str()); + + if(this->CMakePathName == "PROGRAM") + { + this->AddCMakePath("CMAKE_APPBUNDLE_PATH"); + } + else + { + this->AddCMakePath("CMAKE_FRAMEWORK_PATH"); + } } - // Add PATH - cmSystemTools::GetPath(paths); - this->AddPaths(paths); } -void cmFindBase::AddCMakeSystemVariables() -{ - std::string var = "CMAKE_SYSTEM_"; - var += this->CMakePathName; - var += "_PATH"; - std::vector<std::string> paths; - if(const char* prefixPath = - this->Makefile->GetDefinition("CMAKE_SYSTEM_PREFIX_PATH")) +//---------------------------------------------------------------------------- +void cmFindBase::AddSystemEnvironmentPath() +{ + if(!this->NoSystemEnvironmentPath && !this->NoDefaultPath) { - std::vector<std::string> prefixPaths; - cmSystemTools::ExpandListArgument(prefixPath, prefixPaths); - this->AddFindPrefix(paths, prefixPaths); + // Add LIB or INCLUDE + if(!this->EnvironmentPath.empty()) + { + this->AddEnvPath(this->EnvironmentPath.c_str()); + } + // Add PATH + this->AddEnvPath(0); } - if(const char* path = this->Makefile->GetDefinition(var.c_str())) - { - cmSystemTools::ExpandListArgument(path, paths); - } - this->AddPaths(paths); } -void cmFindBase::ExpandRegistryAndCleanPath(std::vector<std::string>& paths) +//---------------------------------------------------------------------------- +void cmFindBase::AddCMakeSystemVariablePath() { - // We should view the registry as the target application would view - // it. - cmSystemTools::KeyWOW64 view = cmSystemTools::KeyWOW64_Default; - cmSystemTools::KeyWOW64 other_view = cmSystemTools::KeyWOW64_Default; - { - if(const char* psize = - this->Makefile->GetDefinition("CMAKE_SIZEOF_VOID_P")) + if(!this->NoCMakeSystemPath && !this->NoDefaultPath) { - switch(atoi(psize)) + std::string var = "CMAKE_SYSTEM_"; + var += this->CMakePathName; + var += "_PATH"; + this->AddCMakePrefixPath("CMAKE_SYSTEM_PREFIX_PATH"); + this->AddCMakePath(var.c_str()); + + if(this->CMakePathName == "PROGRAM") { - case 4: - view = cmSystemTools::KeyWOW64_32; - other_view = cmSystemTools::KeyWOW64_64; - break; - case 8: - view = cmSystemTools::KeyWOW64_64; - other_view = cmSystemTools::KeyWOW64_32; - break; - default: break; + this->AddCMakePath("CMAKE_SYSTEM_APPBUNDLE_PATH"); } - } - } - std::vector<std::string> finalPath; - std::vector<std::string>::iterator i; - // glob and expand registry stuff from paths and put - // into finalPath - for(i = paths.begin(); - i != paths.end(); ++i) - { - std::string expanded = *i; - cmSystemTools::ExpandRegistryValues(expanded, view); - cmSystemTools::GlobDirs(expanded.c_str(), finalPath); - if(view != other_view && expanded != *i && - this->CMakePathName == "PROGRAM") + else { - // Executables can be either 32-bit or 64-bit. - expanded = *i; - cmSystemTools::ExpandRegistryValues(expanded, other_view); - cmSystemTools::GlobDirs(expanded.c_str(), finalPath); + this->AddCMakePath("CMAKE_SYSTEM_FRAMEWORK_PATH"); } } +} + +//---------------------------------------------------------------------------- +void cmFindBase::AddUserHintsPath() +{ + this->AddPathsInternal(this->UserHints, CMakePath); +} + +//---------------------------------------------------------------------------- +void cmFindBase::AddUserGuessPath() +{ + this->AddPathsInternal(this->UserPaths, CMakePath); +} + +//---------------------------------------------------------------------------- +void cmFindBase::AddPathSuffixes() +{ + std::vector<std::string>& paths = this->SearchPaths; + std::vector<std::string> finalPath = paths; + std::vector<std::string>::iterator i; // clear the path paths.clear(); // convert all paths to unix slashes and add search path suffixes diff --git a/Source/cmFindBase.h b/Source/cmFindBase.h index 86a76f75ad..52d49d8c3a 100644 --- a/Source/cmFindBase.h +++ b/Source/cmFindBase.h @@ -41,19 +41,9 @@ public: protected: void PrintFindStuff(); - void ExpandPaths(std::vector<std::string> userPaths); + void ExpandPaths(); + void AddPathSuffixes(); - // add to the SearchPaths - void AddPaths(std::vector<std::string>& paths); - void AddFrameWorkPaths(); - void AddAppBundlePaths(); - void AddEnvironmentVariables(); - void AddFindPrefix(std::vector<std::string>& dest, - const std::vector<std::string>& src); - void AddCMakeVariables(); - void AddSystemEnvironmentVariables(); - void AddCMakeSystemVariables(); - void ExpandRegistryAndCleanPath(std::vector<std::string>& paths); // see if the VariableName is already set in the cache, // also copy the documentation from the cache to VariableDocumentation // if it has documentation in the cache @@ -64,13 +54,26 @@ protected: cmStdString VariableDocumentation; cmStdString VariableName; std::vector<std::string> Names; - std::vector<std::string> SearchPaths; // CMAKE_*_PATH CMAKE_SYSTEM_*_PATH FRAMEWORK|LIBRARY|INCLUDE|PROGRAM cmStdString EnvironmentPath; // LIB,INCLUDE bool AlreadyInCache; bool AlreadyInCacheWithoutMetaInfo; +private: + // Add pieces of the search. + void AddCMakeEnvironmentPath(); + void AddCMakeVariablePath(); + void AddSystemEnvironmentPath(); + void AddCMakeSystemVariablePath(); + void AddUserHintsPath(); + void AddUserGuessPath(); + + // Helpers. + void AddCMakePrefixPath(const char* variable); + void AddEnvPrefixPath(const char* variable); + void AddPrefixPaths(std::vector<std::string> const& in_paths, + PathType pathType); }; diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx index 0c6af0daf7..45ee91ae8d 100644 --- a/Source/cmFindCommon.cxx +++ b/Source/cmFindCommon.cxx @@ -76,14 +76,14 @@ cmFindCommon::cmFindCommon() "then CMAKE_FIND_ROOT_PATH will not be used. If ONLY_CMAKE_FIND_ROOT_PATH " "is used then only the re-rooted directories will be searched.\n"; this->GenericDocumentationPathsOrder = - "The reason the paths listed in the call to the command are searched " - "last is that most users of CMake would expect things to be found " - "first in the locations specified by their environment. Projects may " - "override this behavior by simply calling the command twice:\n" + "The default search order is designed to be most-specific to " + "least-specific for common use cases. " + "Projects may override the order by simply calling the command " + "multiple times and using the NO_* options:\n" " FIND_XXX(FIND_ARGS_XXX PATHS paths... NO_DEFAULT_PATH)\n" " FIND_XXX(FIND_ARGS_XXX)\n" - "Once one of these calls succeeds the result variable will be set " - "and stored in the cache so that neither call will search again."; + "Once one of the calls succeeds the result variable will be set " + "and stored in the cache so that no call will search again."; } //---------------------------------------------------------------------------- @@ -322,93 +322,40 @@ void cmFindCommon::AddPathSuffix(std::string const& arg) } //---------------------------------------------------------------------------- -void cmFindCommon::GetAppBundlePaths(std::vector<std::string>& paths) +void cmFindCommon::AddUserPath(std::string const& p, + std::vector<std::string>& paths) { - if(this->NoDefaultPath) - { - return; - } - std::vector<std::string> tmp; - - // first environment variables - if(!this->NoCMakeEnvironmentPath) - { - cmSystemTools::GetPath(tmp, "CMAKE_APPBUNDLE_PATH"); - this->AddPathsInternal(paths, tmp, EnvPath); - tmp.clear(); - } - - // add cmake variables - if(!this->NoCMakePath) - { - if(const char* path = - this->Makefile->GetDefinition("CMAKE_APPBUNDLE_PATH")) - { - cmSystemTools::ExpandListArgument(path, tmp); - this->AddPathsInternal(paths, tmp, CMakePath); - tmp.clear(); - } - } - - // add cmake system variables - if(!this->NoCMakeSystemPath) - { - if(const char* path = - this->Makefile->GetDefinition("CMAKE_SYSTEM_APPBUNDLE_PATH")) + // We should view the registry as the target application would view + // it. + cmSystemTools::KeyWOW64 view = cmSystemTools::KeyWOW64_32; + cmSystemTools::KeyWOW64 other_view = cmSystemTools::KeyWOW64_64; + if(const char* psize = + this->Makefile->GetDefinition("CMAKE_SIZEOF_VOID_P")) + { + if(atoi(psize) == 8) { - cmSystemTools::ExpandListArgument(path, tmp); - this->AddPathsInternal(paths, tmp, CMakePath); - tmp.clear(); + view = cmSystemTools::KeyWOW64_64; + other_view = cmSystemTools::KeyWOW64_32; } } -} - -//---------------------------------------------------------------------------- -void cmFindCommon::GetFrameworkPaths(std::vector<std::string>& paths) -{ - if(this->NoDefaultPath) - { - return; - } - std::vector<std::string> tmp; - - // first environment variables - if(!this->NoCMakeEnvironmentPath) - { - cmSystemTools::GetPath(tmp, "CMAKE_FRAMEWORK_PATH"); - this->AddPathsInternal(paths, tmp, EnvPath); - tmp.clear(); - } - // add cmake variables - if(!this->NoCMakePath) - { - if(const char* path = - this->Makefile->GetDefinition("CMAKE_FRAMEWORK_PATH")) - { - cmSystemTools::ExpandListArgument(path, tmp); - this->AddPathsInternal(paths, tmp, CMakePath); - tmp.clear(); - } - } + // Expand using the view of the target application. + std::string expanded = p; + cmSystemTools::ExpandRegistryValues(expanded, view); + cmSystemTools::GlobDirs(expanded.c_str(), paths); - // add cmake system variables - if(!this->NoCMakeSystemPath) + // Executables can be either 32-bit or 64-bit, so expand using the + // alternative view. + if(expanded != p && this->CMakePathName == "PROGRAM") { - if(const char* path = - this->Makefile->GetDefinition("CMAKE_SYSTEM_FRAMEWORK_PATH")) - { - cmSystemTools::ExpandListArgument(path, tmp); - this->AddPathsInternal(paths, tmp, CMakePath); - tmp.clear(); - } + expanded = p; + cmSystemTools::ExpandRegistryValues(expanded, other_view); + cmSystemTools::GlobDirs(expanded.c_str(), paths); } } //---------------------------------------------------------------------------- -void cmFindCommon::AddCMakePath(std::vector<std::string>& out_paths, - const char* variable, - std::set<cmStdString>* emmitted) +void cmFindCommon::AddCMakePath(const char* variable) { // Get a path from a CMake variable. if(const char* varPath = this->Makefile->GetDefinition(variable)) @@ -418,14 +365,12 @@ void cmFindCommon::AddCMakePath(std::vector<std::string>& out_paths, // Relative paths are interpreted with respect to the current // source directory. - this->AddPathsInternal(out_paths, tmp, CMakePath, emmitted); + this->AddPathsInternal(tmp, CMakePath); } } //---------------------------------------------------------------------------- -void cmFindCommon::AddEnvPath(std::vector<std::string>& out_paths, - const char* variable, - std::set<cmStdString>* emmitted) +void cmFindCommon::AddEnvPath(const char* variable) { // Get a path from the environment. std::vector<std::string> tmp; @@ -433,27 +378,23 @@ void cmFindCommon::AddEnvPath(std::vector<std::string>& out_paths, // Relative paths are interpreted with respect to the current // working directory. - this->AddPathsInternal(out_paths, tmp, EnvPath, emmitted); + this->AddPathsInternal(tmp, EnvPath); } //---------------------------------------------------------------------------- -void cmFindCommon::AddPathsInternal(std::vector<std::string>& out_paths, - std::vector<std::string> const& in_paths, - PathType pathType, - std::set<cmStdString>* emmitted) +void cmFindCommon::AddPathsInternal(std::vector<std::string> const& in_paths, + PathType pathType) { for(std::vector<std::string>::const_iterator i = in_paths.begin(); i != in_paths.end(); ++i) { - this->AddPathInternal(out_paths, *i, pathType, emmitted); + this->AddPathInternal(*i, pathType); } } //---------------------------------------------------------------------------- -void cmFindCommon::AddPathInternal(std::vector<std::string>& out_paths, - std::string const& in_path, - PathType pathType, - std::set<cmStdString>* emmitted) +void cmFindCommon::AddPathInternal(std::string const& in_path, + PathType pathType) { if(in_path.empty()) { @@ -471,9 +412,24 @@ void cmFindCommon::AddPathInternal(std::vector<std::string>& out_paths, std::string fullPath = cmSystemTools::CollapseFullPath(in_path.c_str(), relbase); - // Insert the path if has not already been emmitted. - if(!emmitted || emmitted->insert(fullPath).second) + // Insert the path if has not already been emitted. + if(this->SearchPathsEmitted.insert(fullPath).second) + { + this->SearchPaths.push_back(fullPath.c_str()); + } +} + +//---------------------------------------------------------------------------- +void cmFindCommon::AddTrailingSlashes(std::vector<std::string>& paths) +{ + // Add a trailing slash to all paths to aid the search process. + for(std::vector<std::string>::iterator i = paths.begin(); + i != paths.end(); ++i) { - out_paths.push_back(fullPath.c_str()); + std::string& p = *i; + if(!p.empty() && p[p.size()-1] != '/') + { + p += "/"; + } } } diff --git a/Source/cmFindCommon.h b/Source/cmFindCommon.h index 962a017bc0..fbb35a2494 100644 --- a/Source/cmFindCommon.h +++ b/Source/cmFindCommon.h @@ -44,6 +44,9 @@ protected: /** Place a set of search paths under the search roots. */ void RerootPaths(std::vector<std::string>& paths); + /** Add trailing slashes to all search paths. */ + void AddTrailingSlashes(std::vector<std::string>& paths); + /** Compute the current default root path mode. */ void SelectDefaultRootPathMode(); @@ -55,21 +58,13 @@ protected: bool CheckCommonArgument(std::string const& arg); void AddPathSuffix(std::string const& arg); - void GetAppBundlePaths(std::vector<std::string>& paths); - void GetFrameworkPaths(std::vector<std::string>& paths); - - void AddCMakePath(std::vector<std::string>& out_paths, - const char* variable, std::set<cmStdString>* emmitted = 0); - void AddEnvPath(std::vector<std::string>& out_paths, - const char* variable, std::set<cmStdString>* emmitted = 0); - void AddPathsInternal(std::vector<std::string>& out_paths, - std::vector<std::string> const& in_paths, - PathType pathType, - std::set<cmStdString>* emmitted = 0); - void AddPathInternal(std::vector<std::string>& out_paths, - std::string const& in_path, - PathType pathType, - std::set<cmStdString>* emmitted = 0); + void AddUserPath(std::string const& p, + std::vector<std::string>& paths); + void AddCMakePath(const char* variable); + void AddEnvPath(const char* variable); + void AddPathsInternal(std::vector<std::string> const& in_paths, + PathType pathType); + void AddPathInternal(std::string const& in_path, PathType pathType); bool NoDefaultPath; bool NoCMakePath; @@ -78,6 +73,10 @@ protected: bool NoCMakeSystemPath; std::vector<std::string> SearchPathSuffixes; + std::vector<std::string> UserPaths; + std::vector<std::string> UserHints; + std::vector<std::string> SearchPaths; + std::set<cmStdString> SearchPathsEmitted; std::string GenericDocumentationMacPolicy; std::string GenericDocumentationRootPath; diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx index ab61401760..1fbe9d16fb 100644 --- a/Source/cmFindLibraryCommand.cxx +++ b/Source/cmFindLibraryCommand.cxx @@ -96,19 +96,15 @@ bool cmFindLibraryCommand this->AddLib64Paths(); } - std::string library; - for(std::vector<std::string>::iterator i = this->Names.begin(); - i != this->Names.end() ; ++i) + std::string library = this->FindLibrary(); + if(library != "") { - library = this->FindLibrary(i->c_str()); - if(library != "") - { - this->Makefile->AddCacheDefinition(this->VariableName.c_str(), - library.c_str(), - this->VariableDocumentation.c_str(), - cmCacheManager::FILEPATH); - return true; - } + // Save the value in the cache + this->Makefile->AddCacheDefinition(this->VariableName.c_str(), + library.c_str(), + this->VariableDocumentation.c_str(), + cmCacheManager::FILEPATH); + return true; } std::string notfound = this->VariableName + "-NOTFOUND"; this->Makefile->AddCacheDefinition(this->VariableName.c_str(), @@ -211,21 +207,29 @@ void cmFindLibraryCommand::AddLib64Paths() } } -std::string cmFindLibraryCommand::FindLibrary(const char* name) +//---------------------------------------------------------------------------- +std::string cmFindLibraryCommand::FindLibrary() { - bool supportFrameworks = false; - bool onlyFrameworks = false; - std::string ff = this->Makefile->GetSafeDefinition("CMAKE_FIND_FRAMEWORK"); - if(ff == "FIRST" || ff == "LAST") + std::string library; + if(this->SearchFrameworkFirst || this->SearchFrameworkOnly) + { + library = this->FindFrameworkLibrary(); + } + if(library.empty() && !this->SearchFrameworkOnly) { - supportFrameworks = true; + library = this->FindNormalLibrary(); } - if(ff == "ONLY") + if(library.empty() && this->SearchFrameworkLast) { - onlyFrameworks = true; - supportFrameworks = true; + library = this->FindFrameworkLibrary(); } - + return library; +} + +//---------------------------------------------------------------------------- +std::string cmFindLibraryCommand::FindNormalLibrary() +{ + // Collect the list of library name prefixes/suffixes to try. const char* prefixes_list = this->Makefile->GetRequiredDefinition("CMAKE_FIND_LIBRARY_PREFIXES"); const char* suffixes_list = @@ -235,51 +239,29 @@ std::string cmFindLibraryCommand::FindLibrary(const char* name) cmSystemTools::ExpandListArgument(prefixes_list, prefixes, true); cmSystemTools::ExpandListArgument(suffixes_list, suffixes, true); - // If the original library name provided by the user matches one of - // the suffixes, try it first. - bool tryOrig = false; - { - std::string nm = name; - for(std::vector<std::string>::const_iterator si = suffixes.begin(); - !tryOrig && si != suffixes.end(); ++si) - { - std::string const& suffix = *si; - if(nm.length() > suffix.length() && - nm.substr(nm.size()-suffix.length()) == suffix) - { - tryOrig = true; - } - } - } - - // Add a trailing slash to all paths to aid the search process. - for(std::vector<std::string>::iterator i = this->SearchPaths.begin(); - i != this->SearchPaths.end(); ++i) - { - std::string& p = *i; - if(p.empty() || p[p.size()-1] != '/') - { - p += "/"; - } - } + // Search the entire path for each name. std::string tryPath; - for(std::vector<std::string>::const_iterator p = this->SearchPaths.begin(); - p != this->SearchPaths.end(); ++p) + for(std::vector<std::string>::const_iterator ni = this->Names.begin(); + ni != this->Names.end() ; ++ni) { - if(supportFrameworks) + // If the original library name provided by the user matches one of + // the suffixes, try it first. + bool tryOrig = false; + std::string const& name = *ni; + for(std::vector<std::string>::const_iterator si = suffixes.begin(); + !tryOrig && si != suffixes.end(); ++si) { - tryPath = *p; - tryPath += name; - tryPath += ".framework"; - if(cmSystemTools::FileExists(tryPath.c_str()) - && cmSystemTools::FileIsDirectory(tryPath.c_str())) + std::string const& suffix = *si; + if(name.length() > suffix.length() && + name.substr(name.size()-suffix.length()) == suffix) { - tryPath = cmSystemTools::CollapseFullPath(tryPath.c_str()); - cmSystemTools::ConvertToUnixSlashes(tryPath); - return tryPath; + tryOrig = true; } } - if(!onlyFrameworks) + + for(std::vector<std::string>::const_iterator + p = this->SearchPaths.begin(); + p != this->SearchPaths.end(); ++p) { // Try the original library name as specified by the user. if(tryOrig) @@ -319,3 +301,26 @@ std::string cmFindLibraryCommand::FindLibrary(const char* name) // Couldn't find the library. return ""; } + +//---------------------------------------------------------------------------- +std::string cmFindLibraryCommand::FindFrameworkLibrary() +{ + // Search for a framework of each name in the entire search path. + for(std::vector<std::string>::const_iterator ni = this->Names.begin(); + ni != this->Names.end() ; ++ni) + { + // Search the paths for a framework with this name. + std::string fwName = *ni; + fwName += ".framework"; + std::string fwPath = cmSystemTools::FindDirectory(fwName.c_str(), + this->SearchPaths, + true); + if(!fwPath.empty()) + { + return fwPath; + } + } + + // No framework found. + return ""; +} diff --git a/Source/cmFindLibraryCommand.h b/Source/cmFindLibraryCommand.h index 233f766a0d..539f9fe1ad 100644 --- a/Source/cmFindLibraryCommand.h +++ b/Source/cmFindLibraryCommand.h @@ -68,7 +68,10 @@ public: protected: void AddArchitecturePaths(const char* suffix); void AddLib64Paths(); - std::string FindLibrary(const char* name); + std::string FindLibrary(); +private: + std::string FindNormalLibrary(); + std::string FindFrameworkLibrary(); }; diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 741a08f130..2bd57f8387 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -1,4 +1,4 @@ -/*========================================================================= + /*========================================================================= Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile$ @@ -112,6 +112,7 @@ cmFindPackageCommand::cmFindPackageCommand() " [[REQUIRED|COMPONENTS] [components...]] [NO_MODULE]\n" " [NAMES name1 [name2 ...]]\n" " [CONFIGS config1 [config2 ...]]\n" + " [HINTS path1 [path2 ... ]]\n" " [PATHS path1 [path2 ... ]]\n" " [PATH_SUFFIXES suffix1 [suffix2 ...]]\n" " [NO_DEFAULT_PATH]\n" @@ -238,35 +239,40 @@ cmFindPackageCommand::cmFindPackageCommand() "CMAKE_FIND_APPBUNDLE determine the order of preference " "as specified below.\n" "The set of installation prefixes is constructed using the following " - "steps. If NO_DEFAULT_PATH is specified steps 1-5 are skipped.\n" - "1. Search cmake specific environment variables. This " - "can be skipped if NO_CMAKE_ENVIRONMENT_PATH is passed.\n" + "steps. If NO_DEFAULT_PATH is specified all NO_* options are enabled.\n" + "1. Search paths specified in cmake-specific cache variables. " + "These are intended to be used on the command line with a -DVAR=value. " + "This can be skipped if NO_CMAKE_PATH is passed.\n" " CMAKE_PREFIX_PATH\n" " CMAKE_FRAMEWORK_PATH\n" " CMAKE_APPBUNDLE_PATH\n" - "2. Search cmake variables with the same names as the cmake specific " - "environment variables. These are intended to be used on the command " - "line with a -DVAR=value. This can be skipped if NO_CMAKE_PATH " - "is passed.\n" + "2. Search paths specified in cmake-specific environment variables. " + "These are intended to be set in the user's shell configuration. " + "This can be skipped if NO_CMAKE_ENVIRONMENT_PATH is passed.\n" " CMAKE_PREFIX_PATH\n" " CMAKE_FRAMEWORK_PATH\n" " CMAKE_APPBUNDLE_PATH\n" - "3. Search the standard system environment variables. " + "3. Search paths specified by the HINTS option. " + "These should be paths computed by system introspection, such as a " + "hint provided by the location of another item already found. " + "Hard-coded guesses should be specified with the PATHS option.\n" + "4. Search the standard system environment variables. " "This can be skipped if NO_SYSTEM_ENVIRONMENT_PATH is passed. " "Path entries ending in \"/bin\" or \"/sbin\" are automatically " "converted to their parent directories.\n" " PATH\n" - "4. Search project build trees recently configured in a CMake GUI. " + "5. Search project build trees recently configured in a CMake GUI. " "This can be skipped if NO_CMAKE_BUILDS_PATH is passed. " "It is intended for the case when a user is building multiple " "dependent projects one after another.\n" - "5. Search cmake variables defined in the Platform files " + "6. Search cmake variables defined in the Platform files " "for the current system. This can be skipped if NO_CMAKE_SYSTEM_PATH " "is passed.\n" " CMAKE_SYSTEM_PREFIX_PATH\n" " CMAKE_SYSTEM_FRAMEWORK_PATH\n" " CMAKE_SYSTEM_APPBUNDLE_PATH\n" - "6. Search paths specified by the PATHS option.\n" + "7. Search paths specified by the PATHS option. " + "These are typically hard-coded guesses.\n" ; this->CommandDocumentation += this->GenericDocumentationMacPolicy; this->CommandDocumentation += this->GenericDocumentationRootPath; @@ -313,7 +319,7 @@ bool cmFindPackageCommand // Parse the arguments. enum Doing { DoingNone, DoingComponents, DoingNames, DoingPaths, - DoingPathSuffixes, DoingConfigs }; + DoingPathSuffixes, DoingConfigs, DoingHints }; Doing doing = DoingNone; cmsys::RegularExpression version("^[0-9.]+$"); bool haveVersion = false; @@ -357,6 +363,12 @@ bool cmFindPackageCommand this->Compatibility_1_6 = false; doing = DoingPaths; } + else if(args[i] == "HINTS") + { + this->NoModule = true; + this->Compatibility_1_6 = false; + doing = DoingHints; + } else if(args[i] == "PATH_SUFFIXES") { this->NoModule = true; @@ -400,7 +412,11 @@ bool cmFindPackageCommand } else if(doing == DoingPaths) { - this->AddUserPath(args[i]); + this->AddUserPath(args[i], this->UserPaths); + } + else if(doing == DoingHints) + { + this->AddUserPath(args[i], this->UserHints); } else if(doing == DoingPathSuffixes) { @@ -821,8 +837,9 @@ void cmFindPackageCommand::FindConfig() //---------------------------------------------------------------------------- bool cmFindPackageCommand::FindPrefixedConfig() { - for(std::vector<std::string>::const_iterator pi = this->Prefixes.begin(); - pi != this->Prefixes.end(); ++pi) + std::vector<std::string>& prefixes = this->SearchPaths; + for(std::vector<std::string>::const_iterator pi = prefixes.begin(); + pi != prefixes.end(); ++pi) { if(this->SearchPrefix(*pi)) { @@ -835,8 +852,9 @@ bool cmFindPackageCommand::FindPrefixedConfig() //---------------------------------------------------------------------------- bool cmFindPackageCommand::FindFrameworkConfig() { - for(std::vector<std::string>::const_iterator i = this->Prefixes.begin(); - i != this->Prefixes.end(); ++i) + std::vector<std::string>& prefixes = this->SearchPaths; + for(std::vector<std::string>::const_iterator i = prefixes.begin(); + i != prefixes.end(); ++i) { if(this->SearchFrameworkPrefix(*i)) { @@ -849,8 +867,9 @@ bool cmFindPackageCommand::FindFrameworkConfig() //---------------------------------------------------------------------------- bool cmFindPackageCommand::FindAppBundleConfig() { - for(std::vector<std::string>::const_iterator i = this->Prefixes.begin(); - i != this->Prefixes.end(); ++i) + std::vector<std::string>& prefixes = this->SearchPaths; + for(std::vector<std::string>::const_iterator i = prefixes.begin(); + i != prefixes.end(); ++i) { if(this->SearchAppBundlePrefix(*i)) { @@ -939,19 +958,21 @@ void cmFindPackageCommand::AppendSuccessInformation() } //---------------------------------------------------------------------------- -void cmFindPackageCommand::AddUserPath(std::string const& p) +void cmFindPackageCommand::ComputePrefixes() { - std::string userPath = p; - cmSystemTools::ExpandRegistryValues(userPath); - this->UserPaths.push_back(userPath); + this->AddPrefixesCMakeVariable(); + this->AddPrefixesCMakeEnvironment(); + this->AddPrefixesUserHints(); + this->AddPrefixesSystemEnvironment(); + this->AddPrefixesBuilds(); + this->AddPrefixesCMakeSystemVariable(); + this->AddPrefixesUserGuess(); + this->ComputeFinalPrefixes(); } //---------------------------------------------------------------------------- -void cmFindPackageCommand::ComputePrefixes() +void cmFindPackageCommand::AddPrefixesCMakeEnvironment() { - std::vector<std::string>& prefixes = this->Prefixes; - std::set<cmStdString> emmitted; - if(!this->NoCMakeEnvironmentPath && !this->NoDefaultPath) { // Check the environment variable with the same name as the cache @@ -960,21 +981,29 @@ void cmFindPackageCommand::ComputePrefixes() if(cmSystemTools::GetEnv(this->Variable.c_str(), env) && env.length() > 0) { cmSystemTools::ConvertToUnixSlashes(env); - this->AddPathInternal(prefixes, env, EnvPath, &emmitted); + this->AddPathInternal(env, EnvPath); } - this->AddEnvPath(prefixes, "CMAKE_PREFIX_PATH", &emmitted); - this->AddEnvPath(prefixes, "CMAKE_FRAMEWORK_PATH", &emmitted); - this->AddEnvPath(prefixes, "CMAKE_APPBUNDLE_PATH", &emmitted); + this->AddEnvPath("CMAKE_PREFIX_PATH"); + this->AddEnvPath("CMAKE_FRAMEWORK_PATH"); + this->AddEnvPath("CMAKE_APPBUNDLE_PATH"); } +} +//---------------------------------------------------------------------------- +void cmFindPackageCommand::AddPrefixesCMakeVariable() +{ if(!this->NoCMakePath && !this->NoDefaultPath) { - this->AddCMakePath(prefixes, "CMAKE_PREFIX_PATH", &emmitted); - this->AddCMakePath(prefixes, "CMAKE_FRAMEWORK_PATH", &emmitted); - this->AddCMakePath(prefixes, "CMAKE_APPBUNDLE_PATH", &emmitted); + this->AddCMakePath("CMAKE_PREFIX_PATH"); + this->AddCMakePath("CMAKE_FRAMEWORK_PATH"); + this->AddCMakePath("CMAKE_APPBUNDLE_PATH"); } +} +//---------------------------------------------------------------------------- +void cmFindPackageCommand::AddPrefixesSystemEnvironment() +{ if(!this->NoSystemEnvironmentPath && !this->NoDefaultPath) { // Use the system search path to generate prefixes. @@ -991,17 +1020,19 @@ void cmFindPackageCommand::ComputePrefixes() if(d.size() >= 4 && strcmp(d.c_str()+d.size()-4, "/bin") == 0 || d.size() >= 5 && strcmp(d.c_str()+d.size()-5, "/sbin") == 0) { - this->AddPathInternal(prefixes, - cmSystemTools::GetFilenamePath(d), - EnvPath, &emmitted); + this->AddPathInternal(cmSystemTools::GetFilenamePath(d), EnvPath); } else { - this->AddPathInternal(prefixes, d, EnvPath, &emmitted); + this->AddPathInternal(d, EnvPath); } } } +} +//---------------------------------------------------------------------------- +void cmFindPackageCommand::AddPrefixesBuilds() +{ if(!this->NoBuilds && !this->NoDefaultPath) { // It is likely that CMake will have recently built the project. @@ -1017,37 +1048,47 @@ void cmFindPackageCommand::ComputePrefixes() if(cmSystemTools::FileIsFullPath(f.c_str()) && cmSystemTools::FileIsDirectory(f.c_str())) { - this->AddPathInternal(prefixes, f, FullPath, &emmitted); + this->AddPathInternal(f, FullPath); } } } +} +//---------------------------------------------------------------------------- +void cmFindPackageCommand::AddPrefixesCMakeSystemVariable() +{ if(!this->NoCMakeSystemPath && !this->NoDefaultPath) { - this->AddCMakePath(prefixes, "CMAKE_SYSTEM_PREFIX_PATH", &emmitted); - this->AddCMakePath(prefixes, "CMAKE_SYSTEM_FRAMEWORK_PATH", &emmitted); - this->AddCMakePath(prefixes, "CMAKE_SYSTEM_APPBUNDLE_PATH", &emmitted); + this->AddCMakePath("CMAKE_SYSTEM_PREFIX_PATH"); + this->AddCMakePath("CMAKE_SYSTEM_FRAMEWORK_PATH"); + this->AddCMakePath("CMAKE_SYSTEM_APPBUNDLE_PATH"); } +} - if(!this->UserPaths.empty()) - { - // Add paths specified by the caller. - this->AddPathsInternal(prefixes, this->UserPaths, CMakePath, &emmitted); - } +//---------------------------------------------------------------------------- +void cmFindPackageCommand::AddPrefixesUserGuess() +{ + // Add guesses specified by the caller. + this->AddPathsInternal(this->UserPaths, CMakePath); +} + +//---------------------------------------------------------------------------- +void cmFindPackageCommand::AddPrefixesUserHints() +{ + // Add hints specified by the caller. + this->AddPathsInternal(this->UserHints, CMakePath); +} + +//---------------------------------------------------------------------------- +void cmFindPackageCommand::ComputeFinalPrefixes() +{ + std::vector<std::string>& prefixes = this->SearchPaths; // Construct the final set of prefixes. this->RerootPaths(prefixes); // Add a trailing slash to all prefixes to aid the search process. - for(std::vector<std::string>::iterator i = prefixes.begin(); - i != prefixes.end(); ++i) - { - std::string& prefix = *i; - if(prefix[prefix.size()-1] != '/') - { - prefix += "/"; - } - } + this->AddTrailingSlashes(prefixes); } //---------------------------------------------------------------------------- diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h index 5581651868..9f3a59fdce 100644 --- a/Source/cmFindPackageCommand.h +++ b/Source/cmFindPackageCommand.h @@ -82,8 +82,15 @@ private: bool ReadListFile(const char* f); void StoreVersionFound(); - void AddUserPath(std::string const& p); void ComputePrefixes(); + void AddPrefixesCMakeEnvironment(); + void AddPrefixesCMakeVariable(); + void AddPrefixesSystemEnvironment(); + void AddPrefixesBuilds(); + void AddPrefixesCMakeSystemVariable(); + void AddPrefixesUserGuess(); + void AddPrefixesUserHints(); + void ComputeFinalPrefixes(); bool SearchDirectory(std::string const& dir); bool CheckDirectory(std::string const& dir); bool FindConfigFile(std::string const& dir, std::string& file); @@ -119,8 +126,6 @@ private: bool DebugMode; std::vector<std::string> Names; std::vector<std::string> Configs; - std::vector<std::string> Prefixes; - std::vector<std::string> UserPaths; }; #endif diff --git a/Source/cmFindPathCommand.cxx b/Source/cmFindPathCommand.cxx index c04594ac6b..2ca4fbb23f 100644 --- a/Source/cmFindPathCommand.cxx +++ b/Source/cmFindPathCommand.cxx @@ -95,67 +95,16 @@ bool cmFindPathCommand } return true; } - std::string ff = this->Makefile->GetSafeDefinition("CMAKE_FIND_FRAMEWORK"); - bool supportFrameworks = true; - if( ff.size() == 0 || ff == "NEVER" ) - { - supportFrameworks = false; - } - std::string framework; - // Add a trailing slash to all paths to aid the search process. - for(std::vector<std::string>::iterator i = this->SearchPaths.begin(); - i != this->SearchPaths.end(); ++i) - { - std::string& p = *i; - if(p.empty() || p[p.size()-1] != '/') - { - p += "/"; - } - } - // Use the search path to find the file. - unsigned int k; - std::string result; - for(k=0; k < this->SearchPaths.size(); k++) + + std::string result = this->FindHeader(); + if(result.size() != 0) { - for(unsigned int j =0; j < this->Names.size(); ++j) - { - // if frameworks are supported try to find the header in a framework - std::string tryPath; - if(supportFrameworks) - { - tryPath = this->FindHeaderInFramework(this->Names[j], - this->SearchPaths[k]); - if(tryPath.size()) - { - result = tryPath; - } - } - if(result.size() == 0) - { - tryPath = this->SearchPaths[k]; - tryPath += this->Names[j]; - if(cmSystemTools::FileExists(tryPath.c_str())) - { - if(this->IncludeFileInPath) - { - result = tryPath; - } - else - { - result = this->SearchPaths[k]; - } - } - } - if(result.size() != 0) - { - this->Makefile->AddCacheDefinition - (this->VariableName.c_str(), result.c_str(), - this->VariableDocumentation.c_str(), - (this->IncludeFileInPath) ? - cmCacheManager::FILEPATH :cmCacheManager::PATH); - return true; - } - } + this->Makefile->AddCacheDefinition + (this->VariableName.c_str(), result.c_str(), + this->VariableDocumentation.c_str(), + (this->IncludeFileInPath) ? + cmCacheManager::FILEPATH :cmCacheManager::PATH); + return true; } this->Makefile->AddCacheDefinition (this->VariableName.c_str(), @@ -166,8 +115,28 @@ bool cmFindPathCommand return true; } -std::string cmFindPathCommand::FindHeaderInFramework(std::string& file, - std::string& dir) +//---------------------------------------------------------------------------- +std::string cmFindPathCommand::FindHeader() +{ + std::string header; + if(this->SearchFrameworkFirst || this->SearchFrameworkOnly) + { + header = this->FindFrameworkHeader(); + } + if(header.empty() && !this->SearchFrameworkOnly) + { + header = this->FindNormalHeader(); + } + if(header.empty() && this->SearchFrameworkLast) + { + header = this->FindFrameworkHeader(); + } + return header; +} + +std::string +cmFindPathCommand::FindHeaderInFramework(std::string const& file, + std::string const& dir) { cmStdString fileName = file; cmStdString frameWorkName; @@ -207,9 +176,9 @@ std::string cmFindPathCommand::FindHeaderInFramework(std::string& file, } } // if it is not found yet or not a framework header, then do a glob search - // for all files in dir/*/Headers/ + // for all frameworks in the directory: dir/*.framework/Headers/<file> cmStdString glob = dir; - glob += "*/Headers/"; + glob += "*.framework/Headers/"; glob += file; cmsys::Glob globIt; globIt.FindFiles(glob); @@ -227,3 +196,51 @@ std::string cmFindPathCommand::FindHeaderInFramework(std::string& file, return ""; } +//---------------------------------------------------------------------------- +std::string cmFindPathCommand::FindNormalHeader() +{ + std::string tryPath; + for(std::vector<std::string>::const_iterator ni = this->Names.begin(); + ni != this->Names.end() ; ++ni) + { + for(std::vector<std::string>::const_iterator + p = this->SearchPaths.begin(); + p != this->SearchPaths.end(); ++p) + { + tryPath = *p; + tryPath += *ni; + if(cmSystemTools::FileExists(tryPath.c_str())) + { + if(this->IncludeFileInPath) + { + return tryPath; + } + else + { + return *p; + } + } + } + } + return ""; +} + +//---------------------------------------------------------------------------- +std::string cmFindPathCommand::FindFrameworkHeader() +{ + for(std::vector<std::string>::const_iterator ni = this->Names.begin(); + ni != this->Names.end() ; ++ni) + { + for(std::vector<std::string>::const_iterator + p = this->SearchPaths.begin(); + p != this->SearchPaths.end(); ++p) + { + std::string fwPath = this->FindHeaderInFramework(*ni, *p); + if(!fwPath.empty()) + { + return fwPath; + } + } + } + return ""; +} diff --git a/Source/cmFindPathCommand.h b/Source/cmFindPathCommand.h index 1baceca32d..f34f31ded6 100644 --- a/Source/cmFindPathCommand.h +++ b/Source/cmFindPathCommand.h @@ -64,12 +64,16 @@ public: return "Find the directory containing a file."; } - std::string FindHeaderInFramework( std::string& file, - std::string& dir); virtual const char* GetFullDocumentation(); cmTypeMacro(cmFindPathCommand, cmFindBase); bool IncludeFileInPath; bool ExtraDocAdded; +private: + std::string FindHeaderInFramework(std::string const& file, + std::string const& dir); + std::string FindHeader(); + std::string FindNormalHeader(); + std::string FindFrameworkHeader(); }; diff --git a/Source/cmFindProgramCommand.cxx b/Source/cmFindProgramCommand.cxx index c2b7ca757c..6ba97fb52c 100644 --- a/Source/cmFindProgramCommand.cxx +++ b/Source/cmFindProgramCommand.cxx @@ -97,8 +97,7 @@ std::string cmFindProgramCommand::FindProgram(std::vector<std::string> names) { std::string program = ""; - // First/last order taken care of in cmFindBase when the paths are setup. - if(this->SearchAppBundleFirst || this->SearchAppBundleLast) + if(this->SearchAppBundleFirst || this->SearchAppBundleOnly) { program = FindAppBundle(names); } @@ -107,6 +106,10 @@ std::string cmFindProgramCommand::FindProgram(std::vector<std::string> names) program = cmSystemTools::FindProgram(names, this->SearchPaths, true); } + if(program.empty() && this->SearchAppBundleLast) + { + program = this->FindAppBundle(names); + } return program; } diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 33a7f208f7..e6436e4199 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -27,9 +27,14 @@ #include "cmVersion.h" #include "cmExportInstallFileGenerator.h" #include "cmComputeTargetDepends.h" +#include "cmGeneratedFileStream.h" #include <cmsys/Directory.hxx> +#if defined(CMAKE_BUILD_WITH_CMAKE) +# include <cmsys/MD5.h> +#endif + #include <stdlib.h> // required for atof #include <assert.h> @@ -405,23 +410,43 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages, fpath = "CMake"; fpath += lang; fpath += "Information.cmake"; - fpath = mf->GetModulesFile(fpath.c_str()); - if(!mf->ReadListFile(0,fpath.c_str())) + std::string informationFile = mf->GetModulesFile(fpath.c_str()); + if (informationFile.empty()) { cmSystemTools::Error("Could not find cmake module file:", fpath.c_str()); } + else if(!mf->ReadListFile(0, informationFile.c_str())) + { + cmSystemTools::Error("Could not process cmake module file:", + informationFile.c_str()); + } } if (needSetLanguageEnabledMaps[lang]) { this->SetLanguageEnabledMaps(lang, mf); } + std::string compilerName = "CMAKE_"; + compilerName += lang; + compilerName += "_COMPILER"; + std::string compilerLangFile = rootBin; + compilerLangFile += "/CMake"; + compilerLangFile += lang; + compilerLangFile += "Compiler.cmake"; // Test the compiler for the language just setup + // (but only if a compiler has been actually found) // At this point we should have enough info for a try compile // which is used in the backward stuff // If the language is untested then test it now with a try compile. - if(needTestLanguage[lang]) + if (!mf->IsSet(compilerName.c_str())) + { + // if the compiler did not work, then remove the + // CMake(LANG)Compiler.cmake file so that it will get tested the + // next time cmake is run + cmSystemTools::RemoveFile(compilerLangFile.c_str()); + } + else if(needTestLanguage[lang]) { if (!this->CMakeInstance->GetIsInTryCompile()) { @@ -442,11 +467,7 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages, // next time cmake is run if(!mf->IsOn(compilerWorks.c_str())) { - fpath = rootBin; - fpath += "/CMake"; - fpath += lang; - fpath += "Compiler.cmake"; - cmSystemTools::RemoveFile(fpath.c_str()); + cmSystemTools::RemoveFile(compilerLangFile.c_str()); } else { @@ -686,6 +707,7 @@ void cmGlobalGenerator::Configure() this->TotalTargets.clear(); this->LocalGeneratorToTargetMap.clear(); this->ProjectMap.clear(); + this->RuleHashes.clear(); // start with this directory cmLocalGenerator *lg = this->CreateLocalGenerator(); @@ -840,6 +862,9 @@ void cmGlobalGenerator::Generate() } this->SetCurrentLocalGenerator(0); + // Update rule hashes. + this->CheckRuleHashes(); + if (this->ExtraGenerator != 0) { this->ExtraGenerator->Generate(); @@ -1931,3 +1956,128 @@ cmGlobalGenerator::GetDirectoryContent(std::string const& dir, bool needDisk) return dc; } +//---------------------------------------------------------------------------- +void +cmGlobalGenerator::AddRuleHash(const std::vector<std::string>& outputs, + std::vector<std::string>::const_iterator first, + std::vector<std::string>::const_iterator last) +{ +#if defined(CMAKE_BUILD_WITH_CMAKE) + // Ignore if there are no outputs. + if(outputs.empty()) + { + return; + } + + // Compute a hash of the rule. + RuleHash hash; + { + unsigned char const* data; + int length; + cmsysMD5* sum = cmsysMD5_New(); + cmsysMD5_Initialize(sum); + for(std::vector<std::string>::const_iterator i = first; i != last; ++i) + { + data = reinterpret_cast<unsigned char const*>(i->c_str()); + length = static_cast<int>(i->length()); + cmsysMD5_Append(sum, data, length); + } + cmsysMD5_FinalizeHex(sum, hash.Data); + cmsysMD5_Delete(sum); + } + + // Shorten the output name (in expected use case). + cmLocalGenerator* lg = this->GetLocalGenerators()[0]; + std::string fname = lg->Convert(outputs[0].c_str(), + cmLocalGenerator::HOME_OUTPUT); + + // Associate the hash with this output. + this->RuleHashes[fname] = hash; +#else + (void)outputs; + (void)first; + (void)last; +#endif +} + +//---------------------------------------------------------------------------- +void cmGlobalGenerator::CheckRuleHashes() +{ +#if defined(CMAKE_BUILD_WITH_CMAKE) + std::string home = this->GetCMakeInstance()->GetHomeOutputDirectory(); + std::string pfile = home; + pfile += this->GetCMakeInstance()->GetCMakeFilesDirectory(); + pfile += "/CMakeRuleHashes.txt"; + +#if defined(_WIN32) || defined(__CYGWIN__) + std::ifstream fin(pfile.c_str(), std::ios::in | std::ios::binary); +#else + std::ifstream fin(pfile.c_str(), std::ios::in); +#endif + std::string line; + std::string fname; + while(cmSystemTools::GetLineFromStream(fin, line)) + { + // Line format is a 32-byte hex string followed by a space + // followed by a file name (with no escaping). + + // Skip blank and comment lines. + if(line.size() < 34 || line[0] == '#') + { + continue; + } + + // Get the filename. + fname = line.substr(33, line.npos); + + // Look for a hash for this file's rule. + std::map<cmStdString, RuleHash>::const_iterator rhi = + this->RuleHashes.find(fname); + if(rhi != this->RuleHashes.end()) + { + // Compare the rule hash in the file to that we were given. + if(strncmp(line.c_str(), rhi->second.Data, 32) != 0) + { + // The rule has changed. Delete the output so it will be + // built again. + fname = cmSystemTools::CollapseFullPath(fname.c_str(), home.c_str()); + cmSystemTools::RemoveFile(fname.c_str()); + } + } + else + { + // We have no hash for a rule previously listed. This may be a + // case where a user has turned off a build option and might + // want to turn it back on later, so do not delete the file. + // Instead, we keep the rule hash as long as the file exists so + // that if the feature is turned back on and the rule has + // changed the file is still rebuilt. + std::string fpath = + cmSystemTools::CollapseFullPath(fname.c_str(), home.c_str()); + if(cmSystemTools::FileExists(fpath.c_str())) + { + RuleHash hash; + strncpy(hash.Data, line.c_str(), 32); + this->RuleHashes[fname] = hash; + } + } + } + + // Now generate a new persistence file with the current hashes. + if(this->RuleHashes.empty()) + { + cmSystemTools::RemoveFile(pfile.c_str()); + } + else + { + cmGeneratedFileStream fout(pfile.c_str()); + fout << "# Hashes of file build rules.\n"; + for(std::map<cmStdString, RuleHash>::const_iterator + rhi = this->RuleHashes.begin(); rhi != this->RuleHashes.end(); ++rhi) + { + fout.write(rhi->second.Data, 32); + fout << " " << rhi->first << "\n"; + } + } +#endif +} diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 519158fff3..2865a38b90 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -245,6 +245,10 @@ public: void FileReplacedDuringGenerate(const std::string& filename); void GetFilesReplacedDuringGenerate(std::vector<std::string>& filenames); + void AddRuleHash(const std::vector<std::string>& outputs, + std::vector<std::string>::const_iterator first, + std::vector<std::string>::const_iterator last); + protected: // for a project collect all its targets by following depend // information, and also collect all the targets @@ -313,6 +317,11 @@ private: // this is used to improve performance std::map<cmStdString,cmTarget *> TotalTargets; + // Record hashes for rules and outputs. + struct RuleHash { char Data[32]; }; + std::map<cmStdString, RuleHash> RuleHashes; + void CheckRuleHashes(); + cmExternalMakefileProjectGenerator* ExtraGenerator; // track files replaced during a Generate diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 43d97b3f6a..ebd228d24b 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -771,7 +771,7 @@ cmGlobalUnixMakefileGenerator3 cmLocalGenerator::FULL, cmLocalGenerator::SHELL); // - std::set<cmStdString> emitted; + std::set<cmTarget *> emitted; progCmd << " " << this->GetTargetTotalNumberOfActions(t->second, emitted); @@ -848,13 +848,13 @@ cmGlobalUnixMakefileGenerator3 //---------------------------------------------------------------------------- int cmGlobalUnixMakefileGenerator3 -::GetTargetTotalNumberOfActions(cmTarget & target, - std::set<cmStdString> &emitted) +::GetTargetTotalNumberOfActions(cmTarget &target, + std::set<cmTarget *> &emitted) { // do not double count int result = 0; - if(emitted.insert(target.GetName()).second) + if(emitted.insert(&target).second) { cmLocalUnixMakefileGenerator3 *lg = static_cast<cmLocalUnixMakefileGenerator3 *> @@ -877,7 +877,7 @@ unsigned long cmGlobalUnixMakefileGenerator3 ::GetNumberOfProgressActionsInAll(cmLocalUnixMakefileGenerator3 *lg) { unsigned long result = 0; - std::set<cmStdString> emitted; + std::set<cmTarget *> emitted; std::set<cmTarget *>& targets = this->LocalGeneratorToTargetMap[lg]; for(std::set<cmTarget *>::iterator t = targets.begin(); t != targets.end(); ++t) @@ -956,16 +956,16 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule } } } - std::vector<cmStdString> const& localHelp = lg->GetLocalHelp(); - for(std::vector<cmStdString>::const_iterator o = localHelp.begin(); - o != localHelp.end(); ++o) - { - path = "... "; - path += *o; - lg->AppendEcho(commands, path.c_str()); - } } } + std::vector<cmStdString> const& localHelp = lg->GetLocalHelp(); + for(std::vector<cmStdString>::const_iterator o = localHelp.begin(); + o != localHelp.end(); ++o) + { + path = "... "; + path += *o; + lg->AppendEcho(commands, path.c_str()); + } lg->WriteMakeRule(ruleFileStream, "Help Target", "help", no_depends, commands, true); diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index cf8059985c..bce1b37451 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -115,7 +115,7 @@ public: // returns some progress informaiton int GetTargetTotalNumberOfActions(cmTarget & target, - std::set<cmStdString> &emitted); + std::set<cmTarget *> &emitted); unsigned long GetNumberOfProgressActionsInAll (cmLocalUnixMakefileGenerator3 *lg); diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 3e31a42fa9..d00a19a73f 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -997,7 +997,7 @@ std::string cmGlobalXCodeGenerator::ExtractFlag(const char* flag, { std::string retFlag; std::string::size_type pos = flags.find(flag); - if(pos != flags.npos) + if(pos != flags.npos && (pos ==0 || flags[pos]==' ')) { while(pos < flags.size() && flags[pos] != ' ') { diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 4c871efc42..26ecab9125 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -487,13 +487,14 @@ bool cmMakefile::ReadListFile(const char* filename_in, { this->cmCurrentListFile = filename; } - // loop over current function blockers and record them - std::list<cmFunctionBlocker *>::iterator pos; - for (pos = this->FunctionBlockers.begin(); - pos != this->FunctionBlockers.end(); ++pos) - { - originalBlockers.insert(*pos); - } + } + + // loop over current function blockers and record them + for (std::list<cmFunctionBlocker *>::iterator pos + = this->FunctionBlockers.begin(); + pos != this->FunctionBlockers.end(); ++pos) + { + originalBlockers.insert(*pos); } // Now read the input file @@ -542,7 +543,7 @@ bool cmMakefile::ReadListFile(const char* filename_in, } // add this list file to the list of dependencies this->ListFiles.push_back( filenametoread); - bool endScopeNicely = filename? true: false; + bool endScopeNicely = true; const size_t numberFunctions = cacheFile.Functions.size(); for(size_t i =0; i < numberFunctions; ++i) { @@ -561,8 +562,8 @@ bool cmMakefile::ReadListFile(const char* filename_in, if (endScopeNicely) { // loop over all function blockers to see if any block this command - std::list<cmFunctionBlocker *>::iterator pos; - for (pos = this->FunctionBlockers.begin(); + for (std::list<cmFunctionBlocker *>::iterator pos + = this->FunctionBlockers.begin(); pos != this->FunctionBlockers.end(); ++pos) { // if this blocker was not in the original then send a @@ -720,6 +721,7 @@ cmMakefile::AddCustomCommandToTarget(const char* target, std::vector<std::string> no_output; cmCustomCommand cc(no_output, depends, commandLines, comment, workingDir); cc.SetEscapeOldStyle(escapeOldStyle); + cc.SetEscapeAllowMakeVars(true); switch(type) { case cmTarget::PRE_BUILD: @@ -833,6 +835,7 @@ cmMakefile::AddCustomCommandToOutput(const std::vector<std::string>& outputs, new cmCustomCommand(outputs, depends2, commandLines, comment, workingDir); cc->SetEscapeOldStyle(escapeOldStyle); + cc->SetEscapeAllowMakeVars(true); file->SetCustomCommand(cc); } } diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 5e724d458e..7d2450dc95 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1116,19 +1116,16 @@ void cmMakefileTargetGenerator ->AppendEcho(commands, comment.c_str(), cmLocalUnixMakefileGenerator3::EchoGenerate); } + // Below we need to skip over the echo and progress commands. + unsigned int skip = static_cast<unsigned int>(commands.size()); + + // Now append the actual user-specified commands. this->LocalGenerator->AppendCustomCommand(commands, cc); // Collect the dependencies. std::vector<std::string> depends; this->LocalGenerator->AppendCustomDepend(depends, cc); - // Add a dependency on the rule file itself. - if(!cc.GetSkipRuleDepends()) - { - this->LocalGenerator->AppendRuleDepend(depends, - this->BuildFileNameFull.c_str()); - } - // Check whether we need to bother checking for a symbolic output. bool need_symbolic = this->GlobalGenerator->GetNeedSymbolicMark(); @@ -1147,6 +1144,14 @@ void cmMakefileTargetGenerator this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, o->c_str(), depends, commands, symbolic); + + // If the rule has changed make sure the output is rebuilt. + if(!symbolic) + { + this->GlobalGenerator->AddRuleHash(cc.GetOutputs(), + commands.begin()+skip, + commands.end()); + } } // Write rules to drive building any outputs beyond the first. diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 6971204b2a..4dffe0c95b 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -3740,7 +3740,7 @@ static bool cmakeCheckStampFile(const char* stampName) // Notify the user why CMake is re-running. It is safe to // just print to stdout here because this code is only reachable // through an undocumented flag used by the VS generator. - std::cout << "CMake is re-running due to explicit user request.\n"; + std::cout << "CMake is re-running because build system is out-of-date.\n"; return false; } @@ -3760,6 +3760,8 @@ static bool cmakeCheckStampFile(const char* stampName) { // The stamp dependencies file cannot be read. Just assume the // build system is really out of date. + std::cout << "CMake is re-running because " << stampName + << " dependency file is missing.\n"; return false; } @@ -3775,6 +3777,8 @@ static bool cmakeCheckStampFile(const char* stampName) { // The stamp depends file is older than this dependency. The // build system is really out of date. + std::cout << "CMake is re-running because " << stampName + << " is out-of-date.\n"; return false; } } diff --git a/Source/kwsys/DynamicLoader.cxx b/Source/kwsys/DynamicLoader.cxx index 0c73d7af19..1fdcaf0115 100644 --- a/Source/kwsys/DynamicLoader.cxx +++ b/Source/kwsys/DynamicLoader.cxx @@ -305,7 +305,7 @@ const char* DynamicLoader::LibExtension() //---------------------------------------------------------------------------- const char* DynamicLoader::LastError() { - LPVOID lpMsgBuf; + LPVOID lpMsgBuf=NULL; FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, @@ -317,6 +317,11 @@ const char* DynamicLoader::LastError() NULL ); + if(!lpMsgBuf) + { + return NULL; + } + static char* str = 0; delete [] str; str = strcpy(new char[strlen((char*)lpMsgBuf)+1], (char*)lpMsgBuf); diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx index 058fddd4b1..373f959431 100644 --- a/Source/kwsys/SystemInformation.cxx +++ b/Source/kwsys/SystemInformation.cxx @@ -218,7 +218,7 @@ protected: unsigned int IsHyperThreadingSupported(); LongLong GetCyclesDifference(DELAY_FUNC, unsigned int); - // For Linux + // For Linux and Cygwin, /proc/cpuinfo formats are slightly different int RetreiveInformationFromCpuInfoFile(); kwsys_stl::string ExtractValueFromCpuInfoFile(kwsys_stl::string buffer, const char* word, size_t init=0); @@ -2158,41 +2158,60 @@ int SystemInformationImplementation::RetreiveInformationFromCpuInfoFile() fileSize++; } fclose( fd ); - buffer.resize(fileSize-2); - - // Number of CPUs + // Number of logical CPUs (combination of multiple processors, multi-core + // and hyperthreading) size_t pos = buffer.find("processor\t"); while(pos != buffer.npos) { this->NumberOfLogicalCPU++; - this->NumberOfPhysicalCPU++; pos = buffer.find("processor\t",pos+1); } - // Count the number of physical ids that are the same - int currentId = -1; - kwsys_stl::string idc = this->ExtractValueFromCpuInfoFile(buffer,"physical id"); - +#ifdef __linux + // Find the largest physical id. + int maxId = -1; + kwsys_stl::string idc = + this->ExtractValueFromCpuInfoFile(buffer,"physical id"); while(this->CurrentPositionInFile != buffer.npos) { - int id = atoi(idc.c_str()); - if(id == currentId) + int id = atoi(idc.c_str()); + if(id > maxId) { - this->NumberOfPhysicalCPU--; + maxId=id; } - currentId = id; - idc = this->ExtractValueFromCpuInfoFile(buffer,"physical id",this->CurrentPositionInFile+1); + idc = this->ExtractValueFromCpuInfoFile(buffer,"physical id", + this->CurrentPositionInFile+1); + } + // Physical ids returned by Linux don't distinguish cores. + // We want to record the total number of cores in this->NumberOfPhysicalCPU + // (checking only the first proc) + kwsys_stl::string cores = + this->ExtractValueFromCpuInfoFile(buffer,"cpu cores"); + int numberOfCoresPerCPU=atoi(cores.c_str()); + this->NumberOfPhysicalCPU=numberOfCoresPerCPU*(maxId+1); + +#else // __CYGWIN__ + // does not have "physical id" entries, neither "cpu cores" + // this has to be fixed for hyper-threading. + kwsys_stl::string cpucount = + this->ExtractValueFromCpuInfoFile(buffer,"cpu count"); + this->NumberOfPhysicalCPU= + this->NumberOfLogicalCPU = atoi(cpucount.c_str()); +#endif + // gotta have one, and if this is 0 then we get a / by 0n + // beter to have a bad answer than a crash + if(this->NumberOfPhysicalCPU <= 0) + { + this->NumberOfPhysicalCPU = 1; } - - if(this->NumberOfPhysicalCPU>0) - { - this->NumberOfLogicalCPU /= this->NumberOfPhysicalCPU; - } + // LogicalProcessorsPerPhysical>1 => hyperthreading. + this->Features.ExtendedFeatures.LogicalProcessorsPerPhysical= + this->NumberOfLogicalCPU/this->NumberOfPhysicalCPU; // CPU speed (checking only the first proc kwsys_stl::string CPUSpeed = this->ExtractValueFromCpuInfoFile(buffer,"cpu MHz"); - this->CPUSpeedInMHz = (float)atof(CPUSpeed.c_str()); + this->CPUSpeedInMHz = static_cast<float>(atof(CPUSpeed.c_str())); // Chip family this->ChipID.Family = atoi(this->ExtractValueFromCpuInfoFile(buffer,"cpu family").c_str()); @@ -2213,8 +2232,6 @@ int SystemInformationImplementation::RetreiveInformationFromCpuInfoFile() cacheSize = cacheSize.substr(0,pos); } this->Features.L1CacheSize = atoi(cacheSize.c_str()); - - return 1; } diff --git a/Source/kwsys/Terminal.c b/Source/kwsys/Terminal.c index dad32722d4..364f08d7b4 100644 --- a/Source/kwsys/Terminal.c +++ b/Source/kwsys/Terminal.c @@ -141,20 +141,38 @@ static const char* kwsysTerminalVT100Names[] = "con80x43", "con80x50", "con80x60", + "cons25", "console", "cygwin", + "dtterm", + "eterm-color", + "gnome", + "gnome-256color", "konsole", "konsole-256color", + "kterm", "linux", "msys", + "linux-c", + "mach-color", + "mlterm", + "putty", "rxvt", + "rxvt-cygwin", + "rxvt-cygwin-native", "rxvt-unicode", "screen", "screen-256color", + "screen-bce", + "screen-w", + "screen.linux", "vt100", "xterm", - "xterm-color", + "xterm-16color", "xterm-256color", + "xterm-88color", + "xterm-color", + "xterm-debian", 0 }; diff --git a/Tests/CMakeTests/A/include/cmake_i_do_not_exist_in_the_system.h b/Tests/CMakeTests/A/include/cmake_i_do_not_exist_in_the_system.h new file mode 100644 index 0000000000..2392aee71d --- /dev/null +++ b/Tests/CMakeTests/A/include/cmake_i_do_not_exist_in_the_system.h @@ -0,0 +1 @@ +/* empty header file */ diff --git a/Tests/CMakeTests/FindBaseTest.cmake.in b/Tests/CMakeTests/FindBaseTest.cmake.in index 7030847112..02f7001524 100644 --- a/Tests/CMakeTests/FindBaseTest.cmake.in +++ b/Tests/CMakeTests/FindBaseTest.cmake.in @@ -1,7 +1,12 @@ set(MY_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@") +# The find_* commands do path normalization so we should do so too +# before comparing results. +get_filename_component(MY_SOURCE_DIR "${MY_SOURCE_DIR}" ABSOLUTE) + set(_HEADER cmake_i_do_not_exist_in_the_system.h) set(_HEADER_FULL "${MY_SOURCE_DIR}/include/${_HEADER}") +set(_HEADER_FULL_A "${MY_SOURCE_DIR}/A/include/${_HEADER}") # at first check that the header isn't found without special measures find_file(FOO_H_1 ${_HEADER}) @@ -9,6 +14,19 @@ if(FOO_H_1) message(FATAL_ERROR "${_HEADER} found: ${FOO_H_1}, it should not exist !") endif(FOO_H_1) +# The HINTS option should override the system but the PATHS option +# should not. +set(CMAKE_SYSTEM_PREFIX_PATH ${MY_SOURCE_DIR}) +find_file(TEST_H_1 ${_HEADER} HINTS ${MY_SOURCE_DIR}/A/include) +find_file(TEST_H_2 ${_HEADER} PATHS ${MY_SOURCE_DIR}/A/include) +if(NOT "${TEST_H_1}" STREQUAL "${_HEADER_FULL_A}") + message(FATAL_ERROR "Did not find \"${_HEADER_FULL_A}\"\ngot \"${TEST_H_1}\" instead!") +endif(NOT "${TEST_H_1}" STREQUAL "${_HEADER_FULL_A}") +if(NOT "${TEST_H_2}" STREQUAL "${_HEADER_FULL}") + message(FATAL_ERROR "Did not find \"${_HEADER_FULL}\"\ngot \"${TEST_H_2}\" instead!") +endif(NOT "${TEST_H_2}" STREQUAL "${_HEADER_FULL}") +set(CMAKE_SYSTEM_PREFIX_PATH) + # with this it still should not be found, since the include/ subdir is still missing set(CMAKE_INCLUDE_PATH "${MY_SOURCE_DIR}") find_file(FOO_H_2 ${_HEADER}) diff --git a/Tests/CustomCommand/CMakeLists.txt b/Tests/CustomCommand/CMakeLists.txt index 5ee05192b0..5d785bc3d5 100644 --- a/Tests/CustomCommand/CMakeLists.txt +++ b/Tests/CustomCommand/CMakeLists.txt @@ -42,6 +42,8 @@ ADD_CUSTOM_COMMAND( MAIN_DEPENDENCY ${PROJECT_SOURCE_DIR}/wrapped.h COMMAND ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/wrapper ${PROJECT_BINARY_DIR}/wrapped.c ${PROJECT_BINARY_DIR}/wrapped_help.c + ${CMAKE_CFG_INTDIR} # this argument tests passing of the configuration + VERBATIM # passing of configuration should work in this mode ) ################################################################ @@ -151,14 +153,6 @@ ADD_EXECUTABLE(CustomCommand ${PROJECT_BINARY_DIR}/generated.c ${PROJECT_BINARY_DIR}/not_included.h gen_redirect.c # default location for custom commands is in build tree - gen_once.c - ) - -# Add a rule with no dependencies. -ADD_CUSTOM_COMMAND( - OUTPUT gen_once.c - COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/gen_once.c.in ${PROJECT_BINARY_DIR}/gen_once.c - SKIP_RULE_DEPENDS ) # Add the rule to create generated.c at build time. This is placed diff --git a/Tests/CustomCommand/foo.in b/Tests/CustomCommand/foo.in index c5ce3403f4..08c559df4d 100644 --- a/Tests/CustomCommand/foo.in +++ b/Tests/CustomCommand/foo.in @@ -6,11 +6,10 @@ int generated(); int wrapped(); -int gen_once(void); int main () { - if (generated()*wrapped()*doc()*gen_once() == 3*5*7*11) + if (generated()*wrapped()*doc() == 3*5*7) { FILE* fin = fopen(PROJECT_BINARY_DIR "/not_included.h", "r"); if(fin) diff --git a/Tests/CustomCommand/gen_once.c.in b/Tests/CustomCommand/gen_once.c.in deleted file mode 100644 index dc8eb672d2..0000000000 --- a/Tests/CustomCommand/gen_once.c.in +++ /dev/null @@ -1 +0,0 @@ -int gen_once(void) { return 11; } diff --git a/Tests/CustomCommand/wrapper.cxx b/Tests/CustomCommand/wrapper.cxx index 3ad0794a97..93cb079fe4 100644 --- a/Tests/CustomCommand/wrapper.cxx +++ b/Tests/CustomCommand/wrapper.cxx @@ -1,4 +1,5 @@ #include <stdio.h> +#include <string.h> int main(int argc, char *argv[]) { @@ -14,5 +15,22 @@ int main(int argc, char *argv[]) fp = fopen(argv[2],"w"); fprintf(fp,"int wrapped_help() { return 5; }\n"); fclose(fp); +#ifdef CMAKE_INTDIR + /* The VS6 IDE passes a leading ".\\" in its variable expansion. */ +# if defined(_MSC_VER) && _MSC_VER == 1200 +# define CFG_DIR ".\\" CMAKE_INTDIR +# else +# define CFG_DIR CMAKE_INTDIR +# endif + const char* cfg = (argc >= 4)? argv[3] : ""; + if(strcmp(cfg, CFG_DIR) != 0) + { + fprintf(stderr, + "Did not receive expected configuration argument:\n" + " expected [" CFG_DIR "]\n" + " received [%s]\n", cfg); + return 1; + } +#endif return 0; } diff --git a/Tests/FindPackageTest/A/wibble-config.cmake b/Tests/FindPackageTest/A/wibble-config.cmake new file mode 100644 index 0000000000..deffa57294 --- /dev/null +++ b/Tests/FindPackageTest/A/wibble-config.cmake @@ -0,0 +1 @@ +# Test config file. diff --git a/Tests/FindPackageTest/B/wibble-config.cmake b/Tests/FindPackageTest/B/wibble-config.cmake new file mode 100644 index 0000000000..deffa57294 --- /dev/null +++ b/Tests/FindPackageTest/B/wibble-config.cmake @@ -0,0 +1 @@ +# Test config file. diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt index e19c7098ab..f02cd70f1f 100644 --- a/Tests/FindPackageTest/CMakeLists.txt +++ b/Tests/FindPackageTest/CMakeLists.txt @@ -36,6 +36,7 @@ FIND_PACKAGE(VersionTestC 1.2.3) SET(PACKAGES foo Foo Bar TFramework Tframework TApp Tapp Special VersionedA VersionedB + wibbleA wibbleB ) FOREACH(p ${PACKAGES}) SET(${p}_DIR "" CACHE FILEPATH "Wipe out find results for testing." FORCE) @@ -58,6 +59,11 @@ FIND_PACKAGE(Special NAMES Suffix SuffixTest PATH_SUFFIXES test) FIND_PACKAGE(VersionedA 2 NAMES zot) FIND_PACKAGE(VersionedB 3.1 EXACT NAMES zot) +# HINTS should override the system but PATHS should not +LIST(INSERT CMAKE_SYSTEM_PREFIX_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}/A") +FIND_PACKAGE(wibbleA NAMES wibble PATHS B) +FIND_PACKAGE(wibbleB NAMES wibble HINTS B) + # Expected locations at which packages should be found. SET(foo_EXPECTED "lib/foo-1.2/foo-config.cmake") SET(Foo_EXPECTED "lib/foo-1.2/CMake/FooConfig.cmake") @@ -73,6 +79,8 @@ SET(Tapp_EXPECTED "TApp.app/Contents/Resources/cmake/tapp-config.cmake") SET(VersionedA_EXPECTED "lib/zot-2.0/zot-config.cmake") SET(VersionedB_EXPECTED "lib/zot-3.1/zot-config.cmake") +SET(wibbleA_EXPECTED "A/wibble-config.cmake") +SET(wibbleB_EXPECTED "B/wibble-config.cmake") # Check the results. FOREACH(p ${PACKAGES}) |