[brlcad-commits] SF.net SVN: brlcad:[40307] brlcad/branches/cmake/misc/CMake/FindTCL.cmake
Open Source Solid Modeling CAD
Brought to you by:
brlcad
From: <sta...@us...> - 2010-08-24 19:02:13
|
Revision: 40307 http://brlcad.svn.sourceforge.net/brlcad/?rev=40307&view=rev Author: starseeker Date: 2010-08-24 19:02:07 +0000 (Tue, 24 Aug 2010) Log Message: ----------- Get the TCL_ADDITIONAL_SEARCH_PATHS and TCL_USE_FRAMEWORK_ONLY logic in place. Modified Paths: -------------- brlcad/branches/cmake/misc/CMake/FindTCL.cmake Modified: brlcad/branches/cmake/misc/CMake/FindTCL.cmake =================================================================== --- brlcad/branches/cmake/misc/CMake/FindTCL.cmake 2010-08-24 18:20:13 UTC (rev 40306) +++ brlcad/branches/cmake/misc/CMake/FindTCL.cmake 2010-08-24 19:02:07 UTC (rev 40307) @@ -60,10 +60,11 @@ # a list of directories and the system path for tcl libraries. # This list can be expanded by a parent CMakeLists.txt file # by specifying additional paths in this variable, which will -# be checked before the system path - essentially, this lets -# a configure process do a "soft set" of the TCL prefix: +# be checked before the system path. Essentially, this lets +# a configure process do a "soft set" of the TCL prefix - look +# here first but if results aren't satisfied check system: # -# TCL_SEARCH_ADDITIONAL_PATHS +# TCL_ADDITIONAL_SEARCH_PATHS # # 5. On Apple platforms, there may be a "Framework" install of # Tcl/Tk. By default, FindTCL will start with this version @@ -218,7 +219,7 @@ ENDIF(dosearch) ENDFOREACH() ENDFOREACH() - MESSAGE("TCL_${targetname}_LIST: ${TCL_${targetname}_LIST}") + #MESSAGE("TCL_${targetname}_LIST: ${TCL_${targetname}_LIST}") ENDMACRO() MACRO(FIND_PROGRAM_VERSIONS targetname pathnames options) @@ -244,9 +245,37 @@ ENDIF(dosearch) ENDFOREACH() ENDFOREACH() - MESSAGE("TCL_${targetname}_LIST: ${TCL_${targetname}_LIST}") + #MESSAGE("TCL_${targetname}_LIST: ${TCL_${targetname}_LIST}") ENDMACRO() +MACRO(FIND_CONFIG_FILES FOUND_FILES TARGET_LIST filename) + SET(LOCAL_FOUND_FILES "${${FOUND_FILES}}") + STRING(REGEX REPLACE "/s?bin" "/lib" FOUND_FILES32 "${LOCAL_FOUND_FILES}") + STRING(REGEX REPLACE "/s?bin" "/lib64" FOUND_FILES64 "${LOCAL_FOUND_FILES}") + SET(LOCAL_FOUND_FILES "${FOUND_FILES32};${FOUND_FILES64}") + LIST(REMOVE_DUPLICATES FOUND_FILES) + SET(FOUND_PATHS "") + FOREACH(foundfile ${LOCAL_FOUND_FILES}) + GET_FILENAME_COMPONENT(FILE_PATH_PARENT "${foundfile}" PATH) + SET(FOUND_PATHS "${FOUND_PATHS}${FILE_PATH_PARENT};") + ENDFOREACH() + LIST(REMOVE_DUPLICATES FOUND_PATHS) + FOREACH(foundpath ${FOUND_PATHS}) + FOREACH(pattern ${TCL_PATH_NOMATCH_PATTERNS}) + if(foundpath MATCHES "${pattern}") + LIST(REMOVE_ITEM FOUND_PATHS ${foundpath}) + endif(foundpath MATCHES "${pattern}") + ENDFOREACH(pattern ${TCL_PATH_NOMATCH_PATTERNS}) + ENDFOREACH() + FOREACH(foundpath ${FOUND_PATHS}) + set(conffile "${filename}-NOTFOUND") + find_file(conffile ${filename} PATHS ${foundpath} NO_SYSTEM_PATH) + if(NOT conffile MATCHES "NOTFOUND$") + SET(${TARGET_LIST} "${${TARGET_LIST}}${conffile};") + endif(NOT conffile MATCHES "NOTFOUND$") + ENDFOREACH() +ENDMACRO() + MACRO(PULL_PREFERRED_VERSION targetname targetvar) FOREACH(MAJORNUM ${TCL_POSSIBLE_MAJOR_VERSIONS}) if(NOT MAJORNUM LESS TCL_MIN_VERSION_MAJOR) @@ -421,56 +450,57 @@ VALIDATE_VERSION(TCLVALID ${CURRENTTCLVERSION}) endif(NOT tclconffile MATCHES "NOTFOUND$") ELSE(TCL_PREFIX) - SET(PATHLIST "$ENV{PATH}") - STRING(REGEX REPLACE ":" ";" PATHLIST "${PATHLIST}") - MESSAGE("PATHLIST: ${PATHLIST}") - FIND_PROGRAM_VERSIONS(tclsh PATHLIST NO_SYSTEM_PATH) - FIND_PROGRAM_VERSIONS(wish PATHLIST NO_SYSTEM_PATH) - SET(LIBPATHLIST "$ENV{PATH}") - STRING(REGEX REPLACE "/s?bin" "" LIBPATHLIST "${LIBPATHLIST}") - SET(LIBPATHLIST "$ENV{LD_LIBRARY_PATH}:$ENV{DYLD_LIBRARY_PATH}:$ENV{DYLD_FALLBACK_LIBRARY_PATH}:${LIBPATHLIST}") - STRING(REGEX REPLACE ":" "/lib;" LIBPATHLIST "${LIBPATHLIST}") - FOREACH(foundpath ${LIBPATHLIST}) - STRING(REGEX REPLACE "/lib" "/lib64" 64BITPATH "${foundpath}") - SET(LIBPATHLIST "${LIBPATHLIST};${64BITPATH}") - ENDFOREACH() - LIST(REMOVE_DUPLICATES LIBPATHLIST) - MESSAGE("LIBPATHLIST: ${LIBPATHLIST}") - FIND_LIBRARY_VERSIONS(tcl LIBPATHLIST NO_SYSTEM_PATH) - SET(FOUND_FILES "${TCL_tclsh_LIST};${TCL_wish_LIST};${TCL_tcl_LIST}") - STRING(REGEX REPLACE "/s?bin" "/lib" FOUND_FILES32 "${FOUND_FILES}") - STRING(REGEX REPLACE "/s?bin" "/lib64" FOUND_FILES64 "${FOUND_FILES}") - SET(FOUND_FILES "${FOUND_FILES32};${FOUND_FILES64}") - LIST(REMOVE_DUPLICATES FOUND_FILES) - MESSAGE("Found files: ${FOUND_FILES}") - SET(FOUND_PATHS "") - FOREACH(foundfile ${FOUND_FILES}) - GET_FILENAME_COMPONENT(FILE_PATH_PARENT "${foundfile}" PATH) - SET(FOUND_PATHS "${FOUND_PATHS}${FILE_PATH_PARENT};") - ENDFOREACH() - LIST(REMOVE_DUPLICATES FOUND_PATHS) - FOREACH(foundpath ${FOUND_PATHS}) - FOREACH(pattern ${TCL_PATH_NOMATCH_PATTERNS}) - if(foundpath MATCHES "${pattern}") - LIST(REMOVE_ITEM FOUND_PATHS ${foundpath}) - endif(foundpath MATCHES "${pattern}") - ENDFOREACH(pattern ${TCL_PATH_NOMATCH_PATTERNS}) - ENDFOREACH() - MESSAGE("Found paths: ${FOUND_PATHS}") SET(TCLCONFIG_LIST "") - FOREACH(foundpath ${FOUND_PATHS}) + IF(APPLE) + INCLUDE(CMakeFindFrameworks) + CMAKE_FIND_FRAMEWORKS(Tcl) + FOREACH(dir ${Tcl_FRAMEWORKS}) set(tclconf "tclConfig.sh-NOTFOUND") - find_file(tclconf tclConfig.sh PATHS ${foundpath}) + find_file(tclconf tclConfig.sh PATHS ${dir}) if(NOT tclconf MATCHES "NOTFOUND$") - SET(TCLCONFIG_LIST "${TCLCONFIG_LIST}${tclconf};") + SET(TCLCONFIG_LIST "${TCLCONFIG_LIST}${tclconf};") endif(NOT tclconf MATCHES "NOTFOUND$") - ENDFOREACH() + ENDFOREACH(dir ${Tcl_FRAMEWORKS}) + IF(TCL_REQUIRE_TK) + CMAKE_FIND_FRAMEWORKS(Tk) + FOREACH(dir ${Tk_FRAMEWORKS}) + set(tkconf "tkConfig.sh-NOTFOUND") + find_file(tkconf tkConfig.sh PATHS ${dir}) + if(NOT tkconf MATCHES "NOTFOUND$") + SET(TKCONFIG_LIST "${TKCONFIG_LIST}${tkconf};") + endif(NOT tkconf MATCHES "NOTFOUND$") + ENDFOREACH(dir ${Tk_FRAMEWORKS}) + ENDIF(TCL_REQUIRE_TK) + ENDIF(APPLE) + IF(NOT APPLE OR NOT TCL_USE_FRAMEWORK_ONLY) + SET(PATHLIST "$ENV{PATH}") + STRING(REGEX REPLACE ":" ";" PATHLIST "${PATHLIST}") + SET(PATHLIST "${TCL_ADDITIONAL_SEARCH_PATHS};${PATHLIST}") + FIND_PROGRAM_VERSIONS(tclsh PATHLIST NO_SYSTEM_PATH) + FIND_PROGRAM_VERSIONS(wish PATHLIST NO_SYSTEM_PATH) + SET(LIBPATHLIST "$ENV{PATH}") + STRING(REGEX REPLACE "/s?bin" "" LIBPATHLIST "${LIBPATHLIST}") + SET(LIBPATHLIST "$ENV{LD_LIBRARY_PATH}:$ENV{DYLD_LIBRARY_PATH}:$ENV{DYLD_FALLBACK_LIBRARY_PATH}:${LIBPATHLIST}") + STRING(REGEX REPLACE ":" "/lib;" LIBPATHLIST "${LIBPATHLIST}") + FOREACH(foundpath ${LIBPATHLIST}) + STRING(REGEX REPLACE "/lib" "/lib64" 64BITPATH "${foundpath}") + SET(LIBPATHLIST "${LIBPATHLIST};${64BITPATH}") + ENDFOREACH() + SET(LIBPATHLIST "${TCL_ADDITIONAL_SEARCH_PATHS};${PATHLIST}") + LIST(REMOVE_DUPLICATES LIBPATHLIST) + FIND_LIBRARY_VERSIONS(tcl LIBPATHLIST NO_SYSTEM_PATH) + FIND_LIBRARY_VERSIONS(tk LIBPATHLIST NO_SYSTEM_PATH) + # Hunt up tclConfig.sh files + SET(FOUND_FILES "${TCL_tclsh_LIST};${TCL_tcl_LIST}") + FIND_CONFIG_FILES(FOUND_FILES TCLCONFIG_LIST tclConfig.sh) + # Hunt up tkConfig.sh files + SET(FOUND_FILES "${TCL_wish_LIST};${TCL_tk_LIST}") + FIND_CONFIG_FILES(FOUND_FILES TKCONFIG_LIST tkConfig.sh) + ENDIF(NOT APPLE OR NOT TCL_USE_FRAMEWORK_ONLY) MESSAGE("Tcl config file list: ${TCLCONFIG_LIST}") + MESSAGE("Tk config file list: ${TKCONFIG_LIST}") - IF(APPLE) - INCLUDE(CMakeFindFrameworks) - CMAKE_FIND_FRAMEWORKS(Tcl) - CMAKE_FIND_FRAMEWORKS(Tk) + IF(0) IF(Tcl_FRAMEWORKS) SET(TCLVALID "NOTFOUND") FOREACH(dir ${Tcl_FRAMEWORKS}) @@ -566,12 +596,7 @@ ENDIF(TCLVALID) MESSAGE("TCL_LIBRARY: ${TCL_LIBRARY}") MESSAGE("TK_LIBRARY: ${TK_LIBRARY}") - ENDIF(APPLE) - IF(NOT TCL_LIBRARY) - - - ENDIF() - + ENDIF(0) ENDIF(TCL_PREFIX) #FOREACH(MAJORNUM ${TCL_FOUND_MAJOR_VERSIONS}) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |