diff options
author | Brad King <brad.king@kitware.com> | 2015-07-06 20:15:49 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-07-06 20:15:49 (GMT) |
commit | bf11253163b54f7c18b001cb00973a6341ee859b (patch) | |
tree | adf50cd777722e5c08168025889c08a2e7ce68da /Modules/CMakeSwiftInformation.cmake | |
parent | 8fbd9584af44100bbddd0f4031b57c5bc2530837 (diff) | |
download | CMake-bf11253163b54f7c18b001cb00973a6341ee859b.zip CMake-bf11253163b54f7c18b001cb00973a6341ee859b.tar.gz CMake-bf11253163b54f7c18b001cb00973a6341ee859b.tar.bz2 |
Add rudimentary support for the Apple Swift language with Xcode
Allow the `Swift` language to be enabled with the Xcode generator for
Xcode >= 6.1. Reject it on other generators and with older Xcode
versions. Since Apple is the only vendor implementing the language
right now, the compiler id can be just `Apple`.
Diffstat (limited to 'Modules/CMakeSwiftInformation.cmake')
-rw-r--r-- | Modules/CMakeSwiftInformation.cmake | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/Modules/CMakeSwiftInformation.cmake b/Modules/CMakeSwiftInformation.cmake new file mode 100644 index 0000000..61ad928 --- /dev/null +++ b/Modules/CMakeSwiftInformation.cmake @@ -0,0 +1,41 @@ + +#============================================================================= +# Copyright 2004-2015 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +set(CMAKE_Swift_OUTPUT_EXTENSION .o) + +# Load compiler-specific information. +if(CMAKE_Swift_COMPILER_ID) + include(Compiler/${CMAKE_Swift_COMPILER_ID}-Swift OPTIONAL) +endif() + +# load the system- and compiler specific files +if(CMAKE_Swift_COMPILER_ID) + # load a hardware specific file, mostly useful for embedded compilers + if(CMAKE_SYSTEM_PROCESSOR) + include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_Swift_COMPILER_ID}-Swift-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL) + endif() + include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_Swift_COMPILER_ID}-Swift OPTIONAL) +endif() + +# for most systems a module is the same as a shared library +# so unless the variable CMAKE_MODULE_EXISTS is set just +# copy the values from the LIBRARY variables +if(NOT CMAKE_MODULE_EXISTS) + set(CMAKE_SHARED_MODULE_Swift_FLAGS ${CMAKE_SHARED_LIBRARY_Swift_FLAGS}) + set(CMAKE_SHARED_MODULE_CREATE_Swift_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_Swift_FLAGS}) +endif() + +include(CMakeCommonLanguageInclude) + +set(CMAKE_Swift_INFORMATION_LOADED 1) |