summaryrefslogtreecommitdiffstats
path: root/Modules/Platform/Darwin.cmake
Commit message (Collapse)AuthorAgeFilesLines
* Genex LINK_LIBRARY: fix some definitions for Apple platformsMarc Chevrier2023-11-011-4/+4
| | | | | | | | Some declarations were inconsistent. For example, "LINKER:-force_load <LIBRARY>" was translated to "-Xlinker -force_load /path/to/library". The correct translation should be "-Xlinker -force_load -Xlinker /path/to/library" because the library is an argument to the -force_load option.
* apple: add preliminary visionOS supportGregor Jasny2023-07-111-1/+1
|
* enable_language: Establish target platform identification variables earlierBrad King2023-06-071-2/+0
| | | | | | | | Set target platform identification variables like `APPLE` and `LINUX` as soon as the target system is identified. This makes them available during toolchain and binutils selection. Fixes: #23333
* Apple: Handle generation and comsuption of text-based stubs (.tbd files)Marc Chevrier2023-03-011-0/+5
| | | | Fixes: #24123
* Genex LINK_LIBRARY: MacOS: enhance *_LIBRARY featuresMarc Chevrier2022-07-031-3/+3
|
* Darwin.cmake: Fix indentingCraig Scott2022-07-031-3/+3
|
* genex-LINK_LIBRARY: Add feature WHOLE_ARCHIVEMarc Chevrier2022-03-171-2/+6
|
* LINK_LIBRARY: Add features for library support on AppleMarc Chevrier2022-03-051-0/+10
|
* Genx-LINK_LIBRARY: simplify framework features definitionsMarc Chevrier2022-03-041-13/+13
|
* genex-LINK_LIBRARY: rename configuration variablesMarc Chevrier2022-02-161-8/+8
| | | | | | To be more consistent between genex and variables as well as the forecomming LINK_GROUP genex, rename variable *_LINK_USING_<FEATURE>* in *_LINK_LIBRARY_USING_<FEATURE>*
* GenEx/LINK_LIBRARY: Add features for framework support on AppleMarc Chevrier2022-02-151-0/+13
|
* macOS: Restore support for Mac OS X 10.4 (Tiger)Evan Miller2021-08-021-1/+3
| | | | | | | | | | | | | | | | Since commit 4aed96e230 (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
* Apple: Set CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG on non-macOS tooCraig Scott2021-04-061-5/+1
| | | | | | | | | | | | | | | 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
* macOS: Add /opt/homebrew to CMAKE_SYSTEM_PREFIX_PATH on Apple SiliconBrad King2020-12-111-0/+7
| | | | | | | According to https://brew.sh/2020/12/01/homebrew-2.6.0/ the `/opt/homebrew` directory is recommended for installing ARM architecture brew packages. Fixes: #21585
* Darwin: honour `CMAKE_OSX_SYSROOT` more faithfullySaleem Abdulrasool2020-05-311-5/+21
| | | | | | | 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.
* Swift: Exclude SDK include pathsYauheni Khnykin2020-02-101-1/+1
| | | | | | | | Populate `CMAKE_Swift_IMPLICIT_INCLUDE_DIRECTORIES` with the macOS SDK's include directory so that we filter such implicit directories out of Swift targets. Fixes: #19845
* macOS: Add support for new Xcode 11 frameworks directoryMarc Chevrier2020-01-101-0/+4
| | | | Update CMAKE_SYSTEM_FRAMEWORK_PATH with new Xcode 11 frameworks directory
* ObjC: Set same settings for all languages supported on DarwinCristian Adam2019-11-071-50/+26
| | | | Fixes: #19928
* Languages: Add support for Objective-C++Steve Wilson2019-09-281-3/+6
| | | | | | | | | | | | | | | | | 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 <cristian.adam@gmail.com>
* Languages: Add support for Objective-CSteve Wilson2019-09-281-1/+6
| | | | | | | | | | | | | | | | | 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 <cristian.adam@gmail.com>
* iOS: Only set the CMAKE_FIND_ROOT_PATH_MODE_* variables when not definedAlexandru Croitor2019-04-301-3/+9
| | | | This allows overriding them in a toolchain file.
* iOS: Only look for packages in the provided CMAKE_FIND_ROOT_PATHsAlexandru Croitor2019-04-301-0/+1
| | | | | | | | | | | | | | | 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.
* iOS: Allow setting multiple CMAKE_FIND_ROOT_PATH valuesAlexandru Croitor2019-04-301-1/+1
| | | | | | | | | | | | | 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.
* iOS: Allow specifying CMAKE_MACOSX_BUNDLE in toolchain fileAlexandru Croitor2019-04-301-1/+3
| | | | | | | | | | 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.
* macOS: Fix addition of <sdk>/usr/include to default implicit include dirsBrad King2019-02-131-1/+1
| | | | | | | | | | | | | | | In commit 1293ed8507 (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.
* Apple: Introduce separate system name for iOS, tvOS, and watchOSGregor Jasny2019-02-041-0/+8
| | | | | | | | | | | - 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
* Merge topic 'fix-macos-sysroot'Brad King2016-11-021-24/+0
|\ | | | | | | | | | | 93504190 Darwin: Remove deployment target version check 542d52f9 Revert "Xcode: Convert maybe unversioned OSX sysroot into versioned SDK path"
| * Darwin: Remove deployment target version checkGregor Jasny2016-11-011-24/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Makefiles: Remove forbidden flag logicStephen Kelly2016-10-091-2/+0
|/ | | | This might have been needed some day in the past, but not anymore.
* Darwin: Add support for tbd library stub filesGregor Jasny2015-08-241-1/+1
| | | | | | | | 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.
* OS X: Look for Xcode 5 platform-specific FrameworksGregor Jasny2015-03-241-6/+14
| | | | | | | | | | | | | | | | | | 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 <gjasny@googlemail.com>
* OS X: Add platform-specific Frameworks search pathGregor Jasny2015-02-231-0/+7
| | | | | | | | | | | | | | | 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 <gjasny@googlemail.com>
* OS X: Allow deployment target with "/" sysroot (#15040)Jeremy Huddleston2014-07-281-0/+2
| | | | | | | | Allow the combination -DCMAKE_OSX_DEPLOYMENT_TARGET="10.8" -DCMAKE_OSX_SYSROOT="/" to work. Treat the "/" sysroot as targeting the current OS X version.
* Merge branch 'master' into osx-init-earlyBrad King2014-04-291-1/+1
|\ | | | | | | | | Resolve conflict in Source/cmGlobalGenerator.cxx by integrating changes from both sides.
| * Remove .* expressions from beginning and end of MATCHES regexsRolf Eike Beer2014-04-141-1/+1
| | | | | | | | | | | | | | | | | | All these expressions work the same: "foo" ".*foo.*" "^.*foo.*$" This assumes that the "Intel*" expressions were meant to be "Intel.*".
* | OS X: Factor a Darwin-Initialize module out of Platform/DarwinBrad King2014-04-291-137/+0
|/ | | | | | Initialize variables CMAKE_OSX_SYSROOT, CMAKE_OSX_DEPLOYMENT_TARGET, and CMAKE_OSX_ARCHITECTURES prior to enabling any languages. This will allow compiler identification to consider these values.
* OS X: Fix app bundle search path during cross compiling (#14603)Flynn Marquardt2013-12-021-1/+3
| | | | | In "Modules/Platform/Darwin.cmake" the variable _apps_paths stays empty if cross compiling. Do not de-duplicate an empty list.
* Drop compatibility with CMake < 2.4Brad King2013-10-231-5/+0
| | | | | | | | | | | | 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.
* OS X: Encode -F framework search flag in per-language platform variableBrad King2013-10-101-0/+5
| | | | | | | | | Compilers for languages other than C and C++ on OS X may not understand the -F framework search flag. Create a new platform information variable CMAKE_<LANG>_FRAMEWORK_SEARCH_FLAG to hold the flag, and set it for C and CXX lanugages in the Platform/Darwin module. Reported-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* OS X: Search system SDKs for frameworksBrad King2013-09-271-0/+9
| | | | | | | | In Modules/Platform/Darwin.cmake set CMAKE_SYSTEM_FRAMEWORK_PATH to include framework directories from inside the system SDK corresponding to CMAKE_OSX_SYSROOT. Suggested-by: Sean McBride <sean@rogue-research.com>
* OS X: Do not default to non-existent deployment target SDKBrad King2013-08-141-2/+14
| | | | | | | 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.
* OS X: Enable command-line build without tools in PATHBrad King2013-08-061-0/+6
| | | | | | | | | | 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.
* OS X: Search for SDK based on deployment target (#14324)Brad King2013-08-021-1/+5
| | | | | | | | When available, use CMAKE_OSX_DEPLOYMENT_TARGET instead of the host OS X version to select the default SDK. This makes sense because one should use the SDK matching the deployment target. Suggested-by: John Ralls <jralls@ceridwen.us>
* OS X: Add RPATH support for Mac.Clinton Stimpson2013-06-031-0/+5
| | | | | | | | | 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.
* Xcode: Add support for shared library versioningClinton Stimpson2013-05-291-6/+2
| | | | | Add a post-build command to shared library targets to create the versioning symbolic links.
* OS X: Detect implicit linker framework search pathsBrad King2012-12-111-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* OS X: Warn about known SDK breakage by Xcode 3.2.6Brad King2012-11-081-0/+17
| | | | | | | Xcode 3.2.6 is known to break the SDK Library/Frameworks layout. Detect and warn about this case to tell users to fix their system. Reported-by: Matthew Brett <matthew.brett@gmail.com>
* OS X: Fix default CMAKE_OSX_SYSROOT with deployment targetBrad King2012-11-051-0/+1
| | | | | | | | | | | Since commit 43b74793 (OS X: Further improve default CMAKE_OSX_SYSROOT selection, 2012-09-21) we choose a default CMAKE_OSX_SYSROOT only when one is needed. However, the change forgot that we require a sysroot when a deployment target is requested. Teach Darwin.cmake to choose a default CMAKE_OSX_SYSROOT when CMAKE_OSX_DEPLOYMENT_TARGET is set. Reported-by: Matthew Brett <matthew.brett@gmail.com> Reported-by: Bradley Giesbrecht <pixilla@macports.org>
* OS X: Teach deployment target sanity check about SDK namesBrad King2012-09-221-20/+30
| | | | | | | | | 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.
* OS X: Further improve default CMAKE_OSX_SYSROOT selectionBrad King2012-09-211-1/+3
| | | | | | | | | Since commit 230ea218 (OS X: Improve default CMAKE_OSX_SYSROOT selection, 2012-09-21) we always set CMAKE_OSX_SYSROOT if any SDK is found in order to support Makefile generator builds with Xcode >= 4.3 without the command-line tools installed. However, in the basic POSIX-only case of the Makefile generator with command-line tools and no CMAKE_OSX_ARCHITECTURES we should not select any SDK by default.