1. 07 Aug, 2021 1 commit
    • Craig Scott's avatar
      Apple: Enable -Wl,-search_paths_first for non-macOS platforms · 21e287dc
      Craig Scott authored
      When building for Apple device platforms, don't expect
      CMAKE_SYSTEM_VERSION to be set and don't set
      DARWIN_MAJOR_VERSION. In turn, don't erroneously query the latter to
      determine whether the -Wl,-search_paths_first linker flag is supported.
      It is expected to be available for all Apple SDKs that we now support.
      
      Projects may be relying on the linker flag not being added, so policy
      CMP0123 provides backward compatibility for this change.
      21e287dc
  2. 02 Aug, 2021 1 commit
    • Evan Miller's avatar
      macOS: Restore support for Mac OS X 10.4 (Tiger) · 1af23c4d
      Evan Miller authored and Brad King's avatar Brad King committed
      Since commit 4aed96e2 (Apple: Set CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG
      on non-macOS too, 2021-04-06, v3.20.1~5^2) we always enable support for
      linking with `-rpath`.  The intention of the change was to enable using
      the flag on iOS, tvOS and watchOS by avoiding a Darwin-specific version
      check.  However, removing the check broke support for OS X 10.4 because
      the flag is not supported on that version.
      
      Restore a form of the check that disables the flag on OS X < 10.5 while
      still allowing it for the other Apple platforms.  Since no one is doing
      iOS/tvOS/etc development on 10.4, this change should have no unintended
      side effects.
      
      Fixes: #22490
      1af23c4d
  3. 05 Apr, 2021 1 commit
    • Craig Scott's avatar
      Apple: Set CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG on non-macOS too · 4aed96e2
      Craig Scott authored
      Since CMake 3.19, we no longer support macOS SDKs older than 10.5,
      which corresponds to Xcode 3. Supporting older Xcode versions for
      device platforms is also not realistic. We therefore expect the -rpath
      linker option should always be supported now.
      
      When targeting iOS, tvOS or watchOS, the previous disabling of -rpath
      support meant that the install_name_dir of shared libraries and
      frameworks was unable to use @rpath. This resulted in embedding
      absolute paths for their install_name. When they were embedded in an
      app bundle, this would cause the app to fail at runtime. By enabling the
      -rpath linker option, the default install_name_dir is now @rpath for these platforms, which results in binaries that do work at runtime.
      
      Fixes: #20036
      4aed96e2
  4. 11 Dec, 2020 1 commit
  5. 30 May, 2020 1 commit
    • Saleem Abdulrasool's avatar
      Darwin: honour `CMAKE_OSX_SYSROOT` more faithfully · 444dbd40
      Saleem Abdulrasool authored
      The libraries in the SDK should be given precedence over the system
      libraries.  Check for the default library search path (in default order)
      of `/usr/lib` and `/usr/local/lib` and use these as system prefix paths
      for libraries when performing the link step against a specified SDK.
      444dbd40
  6. 10 Feb, 2020 1 commit
  7. 10 Jan, 2020 1 commit
  8. 07 Nov, 2019 1 commit
  9. 28 Sep, 2019 2 commits
    • Steve Wilson's avatar
      Languages: Add support for Objective-C++ · 9e66397c
      Steve Wilson authored and Cristian Adam's avatar Cristian Adam committed
      
      
      Add entries in Modules and Modules/Platform to support
      Objective-C++ compiler determination and identification.
      Add Modules to check Objective-C++ compiler flags, source
      compilations, program checks, etc...
      
      Use OBJCXX as the designator of the language, eg:
      
      project(foo OBJCXX)
      
      Add various tests for Objective-C++ language features.  Add
      tests to preserve C++ handling of .M and .mm files when
      Objective-C++ is not a configured language.
      Co-authored-by: Cristian Adam's avatarCristian Adam <cristian.adam@gmail.com>
      9e66397c
    • Steve Wilson's avatar
      Languages: Add support for Objective-C · 80f120a8
      Steve Wilson authored and Cristian Adam's avatar Cristian Adam committed
      
      
      Add entries in Modules and Modules/Platform to support
      Objective-C compiler determination and identification.
      Add Modules to check Objective-C compiler flags, source
      compilations, program checks, etc...
      
      Use OBJC as the designator of the language, eg:
      
      project(foo OBJC)
      
      Add various tests for Objective-C language features.  Add
      tests to preserve C++ handling of .m and .mm files when
      OBJC is not a configured language.
      Co-Authored-By: Cristian Adam's avatarCristian Adam <cristian.adam@gmail.com>
      80f120a8
  10. 30 Apr, 2019 4 commits
    • alcroito's avatar
      iOS: Only set the CMAKE_FIND_ROOT_PATH_MODE_* variables when not defined · 4783b842
      alcroito authored
      This allows overriding them in a toolchain file.
      4783b842
    • alcroito's avatar
      iOS: Only look for packages in the provided CMAKE_FIND_ROOT_PATHs · 5f5e3062
      alcroito authored
      Both CMAKE_FIND_ROOT_PATH_MODE_INCLUDE and
      CMAKE_FIND_ROOT_PATH_MODE_LIBRARY are set to "ONLY" when cross
      building to iOS, but appears that CMAKE_FIND_ROOT_PATH_MODE_PACKAGE
      was overlooked.
      
      This causes packages to be searched for in the host system as well,
      which is incorrect and can lead to linking issues.
      
      Set CMAKE_FIND_ROOT_PATH_MODE_PACKAGE to "ONLY" as well.
      
      CMAKE_FIND_ROOT_PATH_MODE_PROGRAM is not touched, because a user
      might want to find programs / tools on the host system.
      5f5e3062
    • alcroito's avatar
      iOS: Allow setting multiple CMAKE_FIND_ROOT_PATH values · 94c5fa5f
      alcroito authored
      Currently the value is hardcoded to contain only the sysroot for
      the respective darwin platform. This means that it can not be changed
      in a custom toolchain file.
      
      Instead of overriding the value, simply append it. This is similar
      to how it is done in the Google provided Android toolchain file.
      
      The usecase is to allow specifying addiitonal roots to look for
      3rd party packages which are definitely not present in the default
      sysroot.
      94c5fa5f
    • alcroito's avatar
      iOS: Allow specifying CMAKE_MACOSX_BUNDLE in toolchain file · 10113506
      alcroito authored
      Currently CMAKE_MACOSX_BUNDLE is always set to true when compiling
      for iOS. This poses a problem when using the source file
      variant of try_compile. Even if a custom value is passed via
      the CMAKE_FLAGS option, it would still be overridden by the
      Darwin.cmake file.
      
      Only set the value in case no other value was provided before.
      10113506
  11. 13 Feb, 2019 1 commit
    • Brad King's avatar
      macOS: Fix addition of <sdk>/usr/include to default implicit include dirs · 017598a4
      Brad King authored
      In commit 1293ed85 (ParseImplicitIncludeInfo: keep implicit incl.
      consistent when rerunning cmake, 2019-01-30, v3.14.0-rc1~26^2) the
      `Platform/UnixPaths` module was updated to add `/usr/include` to
      `CMAKE_{C,CXX,CUDA}_IMPLICIT_INCLUDE_DIRECTORIES` through an
      initialization variable used by `CMakeDetermineCompilerABI` instead of
      directly.  This approach makes it only a default that can be overridden
      by detection of the implicit include directories really used by the
      compiler.
      
      The addition of `<sdk>/usr/include` to default implicit include
      directories by the `Platform/Darwin` module needs the same update but
      was accidentally left out of the original commit.
      017598a4
  12. 04 Feb, 2019 1 commit
    • Gregor Jasny's avatar
      Apple: Introduce separate system name for iOS, tvOS, and watchOS · 11da882a
      Gregor Jasny authored and Brad King's avatar Brad King committed
      - Remove code signing requirements for non-macOS
      - Do not set deployment target for non-macOS
      - Build static library for compiler feature detection for non-macOS
      - Use framework to run CompilerId tests for watchOS
      - Port tests to new SDK handling
      - Add new Apple cross-compiling section to toolchain documentation
      
      Closes: #17870
      11da882a
  13. 01 Nov, 2016 1 commit
    • Gregor Jasny's avatar
      Darwin: Remove deployment target version check · 93504190
      Gregor Jasny authored and Brad King's avatar Brad King committed
      Starting with Xcode 8 the SDK folder also contains an unversioned entry:
      
          MacOSX.sdk
          MacOSX10.12.sdk -> MacOSX.sdk
      
      If this unversioned path is used CMake cannot detect the SDK version.
      
      Furthermore, querying the SDK version via
      
          xcodebuild -sdk <sysroot> -version Path
      
      gives bogus results for the Command Line Tools installed into `/`.
      
      The OS X deployment target version and SDK version are not as tied as
      they once were, so this check is now more trouble than it is worth.
      Simply remove it.
      
      Closes: #16323
      93504190
  14. 09 Oct, 2016 1 commit
  15. 24 Aug, 2015 1 commit
    • Gregor Jasny's avatar
      Darwin: Add support for tbd library stub files · 67f60958
      Gregor Jasny authored
      Starting with Xcode 7 the OSX and iOS SDKs contain only stub
      files for dynamic system libraries. These stub files contain
      some meta data and a list of exported sysbols in plain text.
      
      They are handled by the toolchain like regular dylibs.
      67f60958
  16. 24 Mar, 2015 1 commit
    • Gregor Jasny's avatar
      OS X: Look for Xcode 5 platform-specific Frameworks · 52642b46
      Gregor Jasny authored and Brad King's avatar Brad King committed
      
      
      The Xcode 5 platform specific framework locations differ from the Xcode
      6 ones.  Look first for the Xcode 6 ones, then for iOS Xcode 5 ones and
      last for the Xcode 5 OS X ones.
      
      For reference, the XCTest.framework is located as follows:
      
       Xcode511.app/Contents/Developer/Library/Frameworks/XCTest.framework
       Xcode511.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/Developer/Library/Frameworks/XCTest.framework
       Xcode511.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk/Developer/Library/Frameworks/XCTest.framework
      
       Xcode601.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks/XCTest.framework
       Xcode601.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Frameworks/XCTest.framework
       Xcode601.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks/XCTest.framework
      Signed-off-by: Gregor Jasny's avatarGregor Jasny <gjasny@googlemail.com>
      52642b46
  17. 23 Feb, 2015 1 commit
    • Gregor Jasny's avatar
      OS X: Add platform-specific Frameworks search path · 0ee2a004
      Gregor Jasny authored and Brad King's avatar Brad King committed
      
      
      Otherwise find_library is unable to lookup the XCTest framework which
      is not located in the SDK serach path:
      
      In the 10.10 SDK the SDK frameworks are located here:
      
        $DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks
      
      whereas the Platform SDKs are located here:
      
        $DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/Library/Frameworks
      Signed-off-by: Gregor Jasny's avatarGregor Jasny <gjasny@googlemail.com>
      0ee2a004
  18. 28 Jul, 2014 1 commit
  19. 29 Apr, 2014 1 commit
  20. 14 Apr, 2014 1 commit
  21. 02 Dec, 2013 1 commit
  22. 23 Oct, 2013 1 commit
    • Brad King's avatar
      Drop compatibility with CMake < 2.4 · 7d47c693
      Brad King authored
      Drop all behavior activated by setting CMAKE_BACKWARDS_COMPATIBILITY to
      a value lower than 2.4, and generate an error when projects or the user
      attempt to do so.  In the error suggest using a CMake 2.8.x release.
      
      Teach cmake_minimum_required to warn about projects that do not require
      at least CMake 2.4.  They are not supported by CMake >= 3.0.
      
      Replace the documentation of CMAKE_BACKWARDS_COMPATIBILITY with a
      reference to policy CMP0001.
      7d47c693
  23. 10 Oct, 2013 1 commit
  24. 27 Sep, 2013 1 commit
  25. 14 Aug, 2013 1 commit
    • Brad King's avatar
      OS X: Do not default to non-existent deployment target SDK · 335a1278
      Brad King authored
      Since commit 95f78e08 (OS X: Search for SDK based on deployment target,
      2013-08-02) we select the default OS X SDK path to match the deployment
      target.  Fix this behavior in the case that the matching SDK does not
      exist and fall back to the SDK for the current host OS X version.
      335a1278
  26. 06 Aug, 2013 1 commit
    • Brad King's avatar
      OS X: Enable command-line build without tools in PATH · 03ab170f
      Brad King authored
      Teach modules CMakeDetermineCompiler and CMakeUnixFindMake to ask Xcode
      where to find the compiler or make tools, using 'xcrun --find', if none
      is found in the PATH.  Teach module Platform/Darwin to add the path to
      the SDK to CMAKE_SYSTEM_PREFIX_PATH so that find_* command look there.
      Also add the SDK /usr/include directory to the implicit include list in
      CMAKE_${lang}_IMPLICIT_INCLUDE_DIRECTORIES to suppress explicit -I
      options for it.
      03ab170f
  27. 02 Aug, 2013 1 commit
  28. 03 Jun, 2013 1 commit
    • Clinton Stimpson's avatar
      OS X: Add RPATH support for Mac. · 94e7fef2
      Clinton Stimpson authored and Brad King's avatar Brad King committed
      RPATH support is activated on targets that have the MACOSX_RPATH
      property turned on.
      For install time, it is also useful to set INSTALL_RPATH to help
      find dependent libraries with an @rpath in their install name.
      
      Also adding detection of rpath conflicts when using frameworks.
      94e7fef2
  29. 29 May, 2013 1 commit
  30. 11 Dec, 2012 1 commit
    • Brad King's avatar
      OS X: Detect implicit linker framework search paths · cc676c3a
      Brad King authored
      Previously we hard-coded a list of implicit framework directories but
      did not account for CMAKE_OSX_SYSROOT or for changes to the list across
      OS X versions.  Instead we should automatically detect the framework
      directories for the active toolchain.
      
      The parent commit added the "-Wl,-v" option to ask "ld" to print its
      implicit directories.  It displays a block such as:
      
       Framework search paths:
      	/...
      
      Parse this block to extract the list of framework directories.
      
      Detection may fail on toolchains that do not list their framework
      directories, such as older OS X linkers.  Always treat the paths
      
       <sdk>/Library/Frameworks
       <sdk>/System/Library/Frameworks
       <sdk>/Network/Library/Frameworks # Older OS X only
       /System/Library/Frameworks
      
      as implicit.  Note that /System/Library/Frameworks should always be
      considered implicit so that frameworks CMake finds there will not
      override the SDK copies.
      cc676c3a
  31. 08 Nov, 2012 1 commit
  32. 05 Nov, 2012 1 commit
  33. 22 Sep, 2012 1 commit
    • Brad King's avatar
      OS X: Teach deployment target sanity check about SDK names · e7e613ef
      Brad King authored
      Since commit 1786b121 (OS X: Allow CMAKE_OSX_SYSROOT to be a logical SDK
      name, 2012-09-21) we support names like "macosx" or "macosx10.7" as the
      specified value of CMAKE_OSX_SYSROOT.  Extend the SDK name->path
      conversion to save the original value and also convert into a temporary
      variable for the Xcode generator.  Re-implement the deployment target
      sanity check to detect the version from the transformed path.
      e7e613ef
  34. 21 Sep, 2012 3 commits