summaryrefslogtreecommitdiffstats
path: root/Modules/Platform/Darwin.cmake
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* OS X: If CMAKE_OSX_SYSROOT is already set do not compute defaultBrad King2012-09-211-4/+6
| | | | | The default computation logic is non-trivial. Do not bother with it if the value is already known.
* OS X: Simplify selection of CMAKE_OSX_ARCHITECTURESBrad King2012-09-211-23/+4
| | | | | Incremental changes to the logic over time have led to simply initializing the cache entry with the environment value.
* OS X: Allow CMAKE_OSX_SYSROOT to be a logical SDK nameBrad King2012-09-211-2/+35
| | | | | | | | | | Xcode supports SDKROOT values that just name an SDK rather than specifying the full path to it. Recognize these values and handle them. For Xcode we just put the value directly in the generated project file. For Makefile generators we ask xcodebuild to provide the full path to the named SDK. Suggested-by: Jason DiCioccio <jd@ods.org>
* OS X: Improve default CMAKE_OSX_SYSROOT selectionBrad King2012-09-211-44/+39
| | | | | | | Simplify the search for OSX_DEVELOPER_ROOT and allow it to fail if no "/Developer" exists. When it does exist, always find a MacOSX SDK inside it to use as the default CMAKE_OSX_SYSROOT. Otherwise set CMAKE_OSX_SYSROOT to empty.
* Remove CMake-language block-end command argumentsKitware Robot2012-08-131-18/+18
| | | | | | | | | | | | | | | | | Ancient versions of CMake required else(), endif(), and similar block termination commands to have arguments matching the command starting the block. This is no longer the preferred style. Run the following shell code: for c in else endif endforeach endfunction endmacro endwhile; do echo 's/\b'"$c"'\(\s*\)(.\+)/'"$c"'\1()/' done >convert.sed && git ls-files -z -- bootstrap '*.cmake' '*.cmake.in' '*CMakeLists.txt' | egrep -z -v '^(Utilities/cm|Source/kwsys/)' | egrep -z -v 'Tests/CMakeTests/While-Endwhile-' | xargs -0 sed -i -f convert.sed && rm convert.sed
* Convert CMake-language commands to lower caseKitware Robot2012-08-131-123/+123
| | | | | | | | | | | | | | | | | Ancient CMake versions required upper-case commands. Later command names became case-insensitive. Now the preferred style is lower-case. Run the following shell code: cmake --help-command-list | grep -v "cmake version" | while read c; do echo 's/\b'"$(echo $c | tr '[:lower:]' '[:upper:]')"'\(\s*\)(/'"$c"'\1(/g' done >convert.sed && git ls-files -z -- bootstrap '*.cmake' '*.cmake.in' '*CMakeLists.txt' | egrep -z -v '^(Utilities/cm|Source/kwsys/)' | xargs -0 sed -i -f convert.sed && rm convert.sed
* Mac: Add guards to CMAKE_FIND_FRAMEWORK and CMAKE_FIND_APPBUNDLE defaultsCharlie Sharpsteen2012-05-311-3/+6
| | | | | | | | The default for `CMAKE_FIND_FRAMEWORK`, defined in `Darwin.cmake` and `Darwin-icc.cmake`, is now guarded so that it will not override command line arguments passed by users. Similarly for `CMAKE_FIND_APPBUNDLE`
* Support building shared libraries or modules without soname (#13155)Modestas Vainius2012-04-301-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a boolean target property NO_SONAME which may be used to disable soname for the specified shared library or module even if the platform supports it. This property should be useful for private shared libraries or various plugins which live in private directories and have not been designed to be found or loaded globally. Replace references to <CMAKE_SHARED_LIBRARY_SONAME_${LANG}_FLAG> and hard-coded -install_name flags with a conditional <SONAME_FLAG> which is expanded to the value of the CMAKE_SHARED_LIBRARY_SONAME_${LANG}_FLAG definition as long as soname supports is enabled for the target in question. Keep expanding CMAKE_SHARED_LIBRARY_SONAME_${LANG}_FLAG in rules in case third party projects still use it. Such projects would not yet use NO_SONAME so the adjacent <TARGET_SONAME> will always be expanded. Make <TARGET_INSTALLNAME_DIR> NO_SONAME aware as well. Since -install_name is soname on OS X, this should not be a problem if this variable is expanded only if soname is enabled. The Ninja generator performs rule variable substitution only once globally per rule to put its own placeholders. Final substitution is performed by ninja at build time. Therefore we cannot conditionally replace the soname placeholders on a per-target basis. Rather than omitting $SONAME from rules.ninja, simply do not write its contents for targets which have NO_SONAME. Since 3 variables are affected by NO_SONAME ($SONAME, $SONAME_FLAG, $INSTALLNAME_DIR), set them only if soname is enabled.
* OS X: Mark find_program results as advancedDavid Cole2012-04-061-0/+2
| | | | | Avoid cluttering the gui with variables nearly nobody needs to see.
* OS X: Use correct extra path when searching for applicaton bundles (#13066)David Cole2012-04-061-3/+15
| | | | | | | | | The parent commit added a search path relative to OSX_DEVELOPER_ROOT. But with Xcode 4.3 the nested Applications folder is in a different relative location compared to that root. This commit makes the intent of the previous commit work with older and newer Xcode directory layouts. Furthermore, it only adds paths that exist to the search path.
* OS X: Use OSX_DEVELOPER_ROOT for app search path (#13066)Kashif Rasul2012-03-261-1/+1
| | | | | | | Since commit 4693cf84 (Xcode: Detect new default locations of Xcode 4.3 bits and pieces) Darwin.cmake detects the developer application directory instead of hard-coding /Developer. Replace the hard-coded path in CMAKE_SYSTEM_APPBUNDLE_PATH using the computed result.
* Xcode: Detect new default locations of Xcode 4.3 bits and pieces (#12621)David Cole2012-03-091-13/+20
| | | | | | | | | | | | | | | | | | | | | | Xcode 4.3 installs into "/Applications" by default, from the Mac App Store. Also, the paths to the available SDKs changed: they are now within the Xcode.app bundle. PackageMaker is installed as a separate program, and may be installed anywhere. It is not installed with Xcode 4.3 by default anymore. Download the "Auxiliary Tools for Xcode" to get PackageMaker. Put PackageMaker inside the Xcode.app bundle, in its nested Applications folder, or put it alongside Xcode in "/Applications" and CMake will find it. Update references to "find" paths: add new possible locations for finding Xcode.app and PackageMaker.app. Prefer the most recent version's locations first, but keep the old locations as fallback search paths, too. Thanks to all the contributors who provided and tested out various patches for fixing this issue. Especially, but by no means limited to: Francisco Requena Espí, Jamie Kirkpatrick and drfrogsplat.
* Do not link private dependent shared libraries on OS X > 10.4Brad King2011-12-151-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The default OS X 10.4 linker incorrectly searches for dependencies of linked shared libraries only under the -isysroot location. It fails to find dependencies of linked shared libraries in cases such as the ExportImport test. It produces errors like: /usr/libexec/gcc/i686-apple-darwin8/4.0.1/ld: warning can't open dynamic library: libtestLib3Imp.dylib referenced from: /.../ExportImport/Root/lib/libtestLib3lib.1.2.dylib (checking for undefined symbols may be affected) (No such file or directory, errno = 2) /usr/libexec/gcc/i686-apple-darwin8/4.0.1/ld: Undefined symbols: _testLib3Imp referenced from libtestLib3lib expected to be defined in libtestLib3Imp.dylib or with CMAKE_SKIP_RPATH off to enable install_name in the Export side: /usr/libexec/gcc/i686-apple-darwin8/4.0.1/ld: warning can't open dynamic library: /Developer/SDKs/MacOSX10.4u.sdk/.../ExportImport/Export/impl/libtestLib3Imp.dylib referenced from: /.../ExportImport/Export/libtestLib3lib.1.2.dylib (checking for undefined symbols may be affected) (No such file or directory, errno = 2) /usr/libexec/gcc/i686-apple-darwin8/4.0.1/ld: Undefined symbols:_testLib3Imp referenced from libtestLib3lib expected to be defined in /.../ExportImport/Export/impl/libtestLib3Imp.dylib Note how "/Developer/SDKs/MacOSX10.4u.sdk" is prepended to the dependent library path. Commit 2cff26fa (Support linking to shared libs with dependent libs, 2008-01-31) and commit 82fcaebe (Pass dependent library search path to linker on some platforms, 2008-02-01) worked around the problem by defining platform variable CMAKE_LINK_DEPENDENT_LIBRARY_FILES. It tells CMake to link to dependent libraries explicitly by their path thus telling the linker where to find them. Unfortunately the workaround had the side effect of linking dependent libraries and defeats most benefits of LINK_INTERFACE_LIBRARIES. Fortunately OS X 10.5 and above do not need to find transitive dependencies at all so we can avoid the workaround on Modern OS X.
* Strip trailing space from xcode-select output (#10723)David Cole2011-02-011-1/+2
| | | | | Otherwise, subsequent use of the output does not work as intended.
* Pass Mac linker flag through PGI compiler using "-Wl,"Brad King2010-11-221-4/+4
| | | | | | | The Mac linker defines -headerpad_max_install_names and the GCC front-end passes this flag through. The PGI compiler does not know about this flag, so we must use -Wl,-headerpad_max_install_names to pass it to the linker instead.
* Search MacPorts /opt/local prefix on MacBrad King2010-09-011-1/+4
| | | | | | Include this prefix in CMAKE_SYSTEM_PREFIX_PATH so that it will be used for all find* commands. Previously only find_library and find_path would look under /opt/local/lib and /opt/local/include, respectively.
* Fix issue #10155 - default value of CMAKE_OSX_DEPLOYMENT_TARGET should ↵David Cole2010-01-291-31/+16
| | | | always be the empty string. When the value of CMAKE_OSX_DEPLOYMENT_TARGET is the empty string, the -mmacosx-version-min flag should not show up on the compiler command line. The logic for selecting default value of CMAKE_OSX_SYSROOT is orthogonal to and independent of the value of the deployment target. The default value for CMAKE_OSX_SYSROOT is the SDK that corresponds to the current version of Mac OSX on which cmake is running.
* Fix issue with SDK not matching initial deployment target chosen by setting ↵David Cole2009-12-231-31/+37
| | | | the MACOSX_DEPLOYMENT_TARGET environment variable. The problem was that we were setting the initial SDK value based on our own internal default value for deplyment target rather than the user's environment variable choice. The solution is to base the default value for the SDK on the deployment target variable after initially caching the deployment target... Every time I'm in this code I think I leave it cleaner, only to be proven otherwise. Let's give this one a whirl. Bleh.
* Fix issues #9959 and #9898 - do not set CMAKE_OSX_DEPLOYMENT_TARGET if ↵David Cole2009-12-151-14/+29
| | | | | | CMAKE_OSX_SYSROOT is set. Default to "" for CMAKE_OSX_DEPLOYMENT_TARGET if CMAKE_OSX_SYSROOT is set. Also, add new error message to detect the case where there is a deployment target, but no SDK has been set. Fix args to STRING REGEX call so that it works even if _sdk_path variable is empty inside sanity check function.
* Reduce duplication in Platform/<os>.cmake filesBrad King2009-12-021-2/+0
| | | | | | | | | | | | | Several platform-wide linker flag variables are defined in Modules/Platform/<os>.cmake files for C and then copied by the Modules/CMake<lang>Information.cmake file for each language. We now use this approach for the variables CMAKE_EXE_EXPORTS_${lang}_FLAG CMAKE_SHARED_LIBRARY_SONAME_${lang}_FLAG CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS to avoid duplication for multiple languages in each platform file.
* Fix check for -isysroot on OS XBrad King2009-09-191-14/+0
| | | | | | | | | | | Previously we checked for this flag by parsing the version number of GCC out of 'gcc --version', but this is not reliable because the format can vary greatly. Now we run 'gcc -v --help' and look for '-isysroot' in the list of options. We also now store the result on a per-language basis in the per-compiler info file "CMake<LANG>Compiler.cmake". This is necessary to make it accessible from try-compile projects so that they generate correctly.
* Add detection of gcc versions that do not support isysroot option and do not ↵Bill Hoffman2009-09-181-0/+14
| | | | use it for them.
* Fix for bug #9466. Change the implementation of OSX arch lists. If no ↵Bill Hoffman2009-09-171-5/+1
| | | | ARCHs are specified by the user then no flags are set. We no longer use CMAKE_OSX_ARCHITECTURES_DEFAULT.
* BUG: Remove implicit include dir suppressionBrad King2009-02-241-1/+0
| | | | | | | We used to suppress generation of -I/usr/include (and on OSX also -I/usr/local/include). This behavior seems to cause more trouble than it's worth, so I'm removing it until someone encounters the original problem it fixed. See issue #8598.
* BUG: Allow third component of Mac OSX sw_vers output to be empty. Mac OSX ↵David Cole2009-02-171-1/+1
| | | | 10.5 was recently reinstalled on dashmacmini3 and pointed out the fact that this expression is faulty when the reported version is simply 10.5 rather than 10.5.x... for example. This fixes it.
* BUG: Remove unnecessary double quotes from SET statements. Hopefully ↵David Cole2009-01-291-8/+8
| | | | resolves the strange and difficult to diagnose (or reproduce) test failures on the dashmacmini2 Continuous dashboard.