@@ -376,12 +376,11 @@ endif()
376376set (ENABLE_VISIBILITY_INT ${ENABLE_VISIBILITY} CACHE BOOL "Whether or not to hide symbols (-fvisibility=hidden)" ${FORCE_CACHE} )
377377# Set strict compiler checks or not
378378if (NOT DEFINED ENABLE_STRICT_TRY_COMPILE)
379- # Unless specified, disable symbols visibility by default
379+ # Unless specified, disable strict try_compile()
380380 set (ENABLE_STRICT_TRY_COMPILE FALSE )
381381 message (STATUS "Using NON-strict compiler checks by default. ENABLE_STRICT_TRY_COMPILE not provided!" )
382382endif ()
383- set (ENABLE_STRICT_TRY_COMPILE_INT ${ENABLE_STRICT_TRY_COMPILE} CACHE BOOL "Whether or not to use strict compiler
384- checks" ${FORCE_CACHE} )
383+ set (ENABLE_STRICT_TRY_COMPILE_INT ${ENABLE_STRICT_TRY_COMPILE} CACHE BOOL "Whether or not to use strict compiler checks" ${FORCE_CACHE} )
385384# Get the SDK version information.
386385execute_process (COMMAND xcodebuild -sdk ${CMAKE_OSX_SYSROOT} -version SDKVersion
387386 OUTPUT_VARIABLE SDK_VERSION
@@ -429,6 +428,15 @@ set(CMAKE_C_CREATE_STATIC_LIBRARY
429428 "${BUILD_LIBTOOL} -static -o <TARGET> <LINK_FLAGS> <OBJECTS> " )
430429set (CMAKE_CXX_CREATE_STATIC_LIBRARY
431430 "${BUILD_LIBTOOL} -static -o <TARGET> <LINK_FLAGS> <OBJECTS> " )
431+ # Find the toolchain's provided install_name_tool if none is found on the host
432+ if (NOT CMAKE_INSTALL_NAME_TOOL)
433+ execute_process (COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT} -find install_name_tool
434+ OUTPUT_VARIABLE CMAKE_INSTALL_NAME_TOOL_INT
435+ ERROR_QUIET
436+ OUTPUT_STRIP_TRAILING_WHITESPACE)
437+ set (CMAKE_INSTALL_NAME_TOOL ${CMAKE_INSTALL_NAME_TOOL_INT} CACHE STRING "" ${FORCE_CACHE} )
438+ message (STATUS "Using install_name_tool: ${CMAKE_INSTALL_NAME_TOOL} " )
439+ endif ()
432440# Get the version of Darwin (OS X) of the host.
433441execute_process (COMMAND uname -r
434442 OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_VERSION
@@ -446,8 +454,8 @@ if(MODERN_CMAKE)
446454
447455 # Provide flags for a combined FAT library build on newer CMake versions
448456 if (PLATFORM_INT MATCHES ".*COMBINED" )
449- set (CMAKE_XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH NO CACHE INTERNAL "" )
450- set (CMAKE_IOS_INSTALL_COMBINED YES CACHE INTERNAL "" )
457+ set (CMAKE_XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH NO CACHE INTERNAL "" ${FORCE_CACHE} )
458+ set (CMAKE_IOS_INSTALL_COMBINED YES CACHE INTERNAL "" ${FORCE_CACHE} )
451459 message (STATUS "Will combine built (static) artifacts into FAT lib..." )
452460 endif ()
453461else ()
@@ -608,40 +616,29 @@ set(CMAKE_SHARED_MODULE_LOADER_CXX_FLAG "-Wl,-bundle_loader,")
608616set (CMAKE_FIND_LIBRARY_SUFFIXES ".tbd" ".dylib" ".so" ".a" )
609617set (CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-install_name" )
610618
611- # Hack: if a new cmake (which uses CMAKE_INSTALL_NAME_TOOL) runs on an old
612- # build tree (where install_name_tool was hardcoded) and where
613- # CMAKE_INSTALL_NAME_TOOL isn't in the cache and still cmake didn't fail in
614- # CMakeFindBinUtils.cmake (because it isn't rerun) hardcode
615- # CMAKE_INSTALL_NAME_TOOL here to install_name_tool, so it behaves as it did
616- # before, Alex.
617- if (NOT DEFINED CMAKE_INSTALL_NAME_TOOL)
618- find_program (CMAKE_INSTALL_NAME_TOOL install_name_tool)
619- endif (NOT DEFINED CMAKE_INSTALL_NAME_TOOL)
620-
621619# Set the find root to the iOS developer roots and to user defined paths.
622- set (CMAKE_FIND_ROOT_PATH ${CMAKE_DEVELOPER_ROOT } ${CMAKE_OSX_SYSROOT_INT}
623- ${CMAKE_PREFIX_PATH} CACHE STRING "Root path that will be prepended to all search paths" )
620+ set (CMAKE_FIND_ROOT_PATH ${CMAKE_OSX_SYSROOT_INT } ${CMAKE_PREFIX_PATH} CACHE STRING "Root path that will be prepended
621+ to all search paths" )
624622# Default to searching for frameworks first.
625623set (CMAKE_FIND_FRAMEWORK FIRST)
626624# Set up the default search directories for frameworks.
627625set (CMAKE_FRAMEWORK_PATH
628- ${CMAKE_DEVELOPER_ROOT} /Library/Frameworks
629626 ${CMAKE_DEVELOPER_ROOT} /Library/PrivateFrameworks
630627 ${CMAKE_OSX_SYSROOT_INT} /System /Library/Frameworks
631- ${CMAKE_FRAMEWORK_PATH} CACHE STRING "Frameworks search paths" )
628+ ${CMAKE_FRAMEWORK_PATH} CACHE STRING "Frameworks search paths" ${FORCE_CACHE} )
632629
633630# By default, search both the specified iOS SDK and the remainder of the host filesystem.
634631if (NOT CMAKE_FIND_ROOT_PATH_MODE_PROGRAM)
635632 set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH CACHE STRING "" ${FORCE_CACHE} )
636633endif ()
637634if (NOT CMAKE_FIND_ROOT_PATH_MODE_LIBRARY)
638- set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH CACHE STRING "" ${FORCE_CACHE} )
635+ set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY CACHE STRING "" ${FORCE_CACHE} )
639636endif ()
640637if (NOT CMAKE_FIND_ROOT_PATH_MODE_INCLUDE)
641- set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH CACHE STRING "" ${FORCE_CACHE} )
638+ set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY CACHE STRING "" ${FORCE_CACHE} )
642639endif ()
643640if (NOT CMAKE_FIND_ROOT_PATH_MODE_PACKAGE)
644- set (CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH CACHE STRING "" ${FORCE_CACHE} )
641+ set (CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY CACHE STRING "" ${FORCE_CACHE} )
645642endif ()
646643
647644#
0 commit comments