Commit a24e97e7 authored by Steve Wilson's avatar Steve Wilson
Browse files

Languages: Add support for Objective-C++

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.
parent 6acda14d
enable_language
---------------
Enable a language (CXX/C/OBJC/Fortran/etc)
Enable a language (CXX/C/OBJC/OBJCXX/Fortran/etc)
::
......@@ -10,7 +10,7 @@ Enable a language (CXX/C/OBJC/Fortran/etc)
This command enables support for the named language in CMake. This is
the same as the project command but does not create any of the extra
variables that are created by the project command. Example languages
are CXX, C, OBJC, Fortran.
are CXX, C, OBJC, OBJCXX, Fortran.
This command must be called in file scope, not in a function call.
Furthermore, it must be called in the highest directory common to all
......
......@@ -42,7 +42,7 @@ Variables corresponding to unspecified versions are set to the empty string
Optionally you can specify which languages your project supports.
Example languages are ``C``, ``CXX`` (i.e. C++), ``Fortran``,
``OBJC`` (i.e. Objective-C), etc.
``OBJC`` (i.e. Objective-C), ``OBJCXX`` etc.
By default ``C`` and ``CXX`` are enabled if no language options are
given. Specify language ``NONE``, or use the ``LANGUAGES`` keyword
and list no languages, to skip enabling any languages.
......
......@@ -70,6 +70,8 @@ otherwise expands to nothing.
``1`` if the CMake-id of the CXX compiler matches ``comp``, otherwise ``0``.
``$<OBJC_COMPILER_ID:comp>``
``1`` if the CMake-id of the OBJC compiler matches ``comp``, otherwise ``0``.
``$<OBJCXX_COMPILER_ID:comp>``
``1`` if the CMake-id of the OBJCXX compiler matches ``comp``, otherwise ``0``.
``$<VERSION_GREATER:v1,v2>``
``1`` if ``v1`` is a version greater than ``v2``, else ``0``.
``$<VERSION_LESS:v1,v2>``
......@@ -121,6 +123,8 @@ than 4.2.0.
The version of the CXX compiler used.
``$<OBJC_COMPILER_VERSION>``
The version of the OBJC compiler used.
``$<OBJCXX_COMPILER_VERSION>``
The version of the OBJCXX compiler used.
``$<TARGET_FILE:tgt>``
Full path to main file (.exe, .so.1.2, .a) where ``tgt`` is the name of a target.
``$<TARGET_FILE_NAME:tgt>``
......
......@@ -32,6 +32,9 @@ All Modules
/module/CheckOBJCCompilerFlag
/module/CheckOBJCSourceCompiles
/module/CheckOBJCSourceRuns
/module/CheckOBJCXXCompilerFlag
/module/CheckOBJCXXSourceCompiles
/module/CheckOBJCXXSourceRuns
/module/CheckPrototypeDefinition
/module/CheckStructHasMember
/module/CheckSymbolExists
......
.. cmake-module:: ../../Modules/CheckOBJCXXCompilerFlag.cmake
.. cmake-module:: ../../Modules/CheckOBJCXXSourceCompiles.cmake
.. cmake-module:: ../../Modules/CheckOBJCXXSourceRuns.cmake
......@@ -31,8 +31,12 @@ endif()
set(CMAKE_CXX_COMPILER_ID_RUN 1)
set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC)
if(CMAKE_OBJC_ENABLED)
if(CMAKE_OBJC_ENABLED AND NOT CMAKE_OBJCXX_ENABLED)
set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;mm;CPP)
elseif(CMAKE_OBJCXX_ENABLED AND NOT CMAKE_OBJC_ENABLED)
set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;c++;cc;cpp;cxx;m;CPP)
elseif(CMAKE_OBJC_ENABLED AND CMAKE_OBJCXX_ENABLED)
set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;c++;cc;cpp;cxx;CPP)
else()
set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;CPP)
endif()
......
#=============================================================================
# Copyright 2002-2014 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.)
# determine the compiler to use for Objective-C++ programs
# NOTE, a generator may set CMAKE_OBJCXX_COMPILER before
# loading this file to force a compiler.
# use environment variable OBJCXX first if defined by user, next use
# the cmake variable CMAKE_GENERATOR_OBJCXX which can be defined by a generator
# as a default compiler
# Sets the following variables:
# CMAKE_OBJCXX_COMPILER
# CMAKE_AR
# CMAKE_RANLIB
# CMAKE_COMPILER_IS_GNUOBJCXX
# CMAKE_COMPILER_IS_CLANGOBJCXX
#
# If not already set before, it also sets
# _CMAKE_TOOLCHAIN_PREFIX
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake)
# Load system-specific compiler preferences for this language.
include(Platform/${CMAKE_SYSTEM_NAME}-OBJCXX OPTIONAL)
if(NOT CMAKE_OBJCXX_COMPILER_NAMES)
set(CMAKE_OBJCXX_COMPILER_NAMES clang++)
endif()
if("${CMAKE_GENERATOR}" MATCHES "Xcode")
set(CMAKE_OBJCXX_COMPILER_XCODE_TYPE sourcecode.c.objc)
else()
if(NOT CMAKE_OBJCXX_COMPILER)
set(CMAKE_OBJCXX_COMPILER_INIT NOTFOUND)
# prefer the environment variable OBJCXX
if($ENV{OBJCXX} MATCHES ".+")
get_filename_component(CMAKE_OBJCXX_COMPILER_INIT $ENV{OBJCXX} PROGRAM PROGRAM_ARGS CMAKE_OBJCXX_FLAGS_ENV_INIT)
if(CMAKE_OBJCXX_FLAGS_ENV_INIT)
set(CMAKE_OBJCXX_COMPILER_ARG1 "${CMAKE_OBJCXX_FLAGS_ENV_INIT}" CACHE STRING "First argument to Objective-C++ compiler")
endif()
if(NOT EXISTS ${CMAKE_OBJCXX_COMPILER_INIT})
message(FATAL_ERROR "Could not find compiler set in environment variable OBJCXX:\n$ENV{OBJCXX}.")
endif()
endif()
# next try prefer the compiler specified by the generator
if(CMAKE_GENERATOR_OBJCXX)
if(NOT CMAKE_OBJCXX_COMPILER_INIT)
set(CMAKE_OBJCXX_COMPILER_INIT ${CMAKE_GENERATOR_OBJCXX})
endif()
endif()
# finally list compilers to try
if(NOT CMAKE_OBJCXX_COMPILER_INIT)
set(CMAKE_OBJCXX_COMPILER_LIST ${_CMAKE_TOOLCHAIN_PREFIX}c++ ${_CMAKE_TOOLCHAIN_PREFIX}g++ clang++)
endif()
_cmake_find_compiler(OBJCXX)
else()
# we only get here if CMAKE_OBJCXX_COMPILER was specified using -D or a pre-made CMakeCache.txt
# (e.g. via ctest) or set in CMAKE_TOOLCHAIN_FILE
# if CMAKE_OBJCXX_COMPILER is a list of length 2, use the first item as
# CMAKE_OBJCXX_COMPILER and the 2nd one as CMAKE_OBJCXX_COMPILER_ARG1
list(LENGTH CMAKE_OBJCXX_COMPILER _CMAKE_OBJCXX_COMPILER_LIST_LENGTH)
if("${_CMAKE_OBJCXX_COMPILER_LIST_LENGTH}" EQUAL 2)
list(GET CMAKE_OBJCXX_COMPILER 1 CMAKE_OBJCXX_COMPILER_ARG1)
list(GET CMAKE_OBJCXX_COMPILER 0 CMAKE_OBJCXX_COMPILER)
endif()
# if a compiler was specified by the user but without path,
# now try to find it with the full path
# if it is found, force it into the cache,
# if not, don't overwrite the setting (which was given by the user) with "NOTFOUND"
# if the C compiler already had a path, reuse it for searching the CXX compiler
get_filename_component(_CMAKE_USER_OBJCXX_COMPILER_PATH "${CMAKE_OBJCXX_COMPILER}" PATH)
if(NOT _CMAKE_USER_OBJCXX_COMPILER_PATH)
find_program(CMAKE_OBJCXX_COMPILER_WITH_PATH NAMES ${CMAKE_OBJCXX_COMPILER})
if(CMAKE_OBJCXX_COMPILER_WITH_PATH)
set(CMAKE_OBJCXX_COMPILER ${CMAKE_OBJCXX_COMPILER_WITH_PATH} CACHE STRING "Objective-C++ compiler" FORCE)
endif()
unset(CMAKE_OBJCXX_COMPILER_WITH_PATH CACHE)
endif()
endif()
mark_as_advanced(CMAKE_OBJCXX_COMPILER)
# Each entry in this list is a set of extra flags to try
# adding to the compile line to see if it helps produce
# a valid identification file.
set(CMAKE_OBJCXX_COMPILER_ID_TEST_FLAGS
# Try compiling to an object file only.
"-c"
)
endif()
# Build a small source file to identify the compiler.
if(NOT CMAKE_OBJCXX_COMPILER_ID_RUN)
set(CMAKE_OBJCXX_COMPILER_ID_RUN 1)
# Try to identify the compiler.
set(CMAKE_OBJCXX_COMPILER_ID)
file(READ ${CMAKE_ROOT}/Modules/CMakePlatformId.h.in
CMAKE_OBJCXX_COMPILER_ID_PLATFORM_CONTENT)
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake)
CMAKE_DETERMINE_COMPILER_ID(OBJCXX OBJCXXCFLAGS CMakeOBJCXXCompilerId.mm)
# Set old compiler and platform id variables.
if("${CMAKE_C_COMPILER_ID}" MATCHES "GNU")
set(CMAKE_COMPILER_IS_GNUOBJCXX 1)
endif()
if("${CMAKE_C_COMPILER_ID}" MATCHES "GNU")
set(CMAKE_COMPILER_IS_CLANGOBJCXX 1)
endif()
endif()
if (NOT _CMAKE_TOOLCHAIN_LOCATION)
get_filename_component(_CMAKE_TOOLCHAIN_LOCATION "${CMAKE_OBJCXX_COMPILER}" PATH)
endif ()
# If we have a gcc cross compiler, they have usually some prefix, like
# e.g. powerpc-linux-gcc, arm-elf-gcc or i586-mingw32msvc-gcc, optionally
# with a 3-component version number at the end (e.g. arm-eabi-gcc-4.5.2).
# The other tools of the toolchain usually have the same prefix
# NAME_WE cannot be used since then this test will fail for names like
# "arm-unknown-nto-qnx6.3.0-gcc.exe", where BASENAME would be
# "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-"
if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX)
if("${CMAKE_OBJCXX_COMPILER_ID}" MATCHES "GNU" OR "${CMAKE_OBJCXX_COMPILER_ID}" MATCHES "Clang")
get_filename_component(COMPILER_BASENAME "${CMAKE_OBJCXX_COMPILER}" NAME)
if (COMPILER_BASENAME MATCHES "^(.+-)(clang|g?cc)(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
elseif("${CMAKE_OBJCXX_COMPILER_ID}" MATCHES "Clang")
set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_OBJCXX_COMPILER_TARGET}-)
elseif(COMPILER_BASENAME MATCHES "qcc(\\.exe)?$")
if(CMAKE_OBJCXX_COMPILER_TARGET MATCHES "gcc_nto([^_le]+)(le)?.*$")
set(_CMAKE_TOOLCHAIN_PREFIX nto${CMAKE_MATCH_1}-)
endif()
endif ()
# if "llvm-" is part of the prefix, remove it, since llvm doesn't have its own binutils
# but uses the regular ar, objcopy, etc. (instead of llvm-objcopy etc.)
if ("${_CMAKE_TOOLCHAIN_PREFIX}" MATCHES "(.+-)?llvm-$")
set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
endif ()
endif()
endif ()
include(CMakeFindBinUtils)
# Look for libtool:
if(NOT CMAKE_LIBTOOL)
find_program(CMAKE_LIBTOOL NAMES libtool HINTS "${_CMAKE_TOOLCHAIN_LOCATION}" DOC "Libtool")
endif()
# configure variables set in this file for fast reload later on
configure_file(${CMAKE_ROOT}/Modules/CMakeOBJCXXCompiler.cmake.in
${CMAKE_PLATFORM_INFO_DIR}/CMakeOBJCXXCompiler.cmake
@ONLY
)
set(CMAKE_OBJCXX_COMPILER_ENV_VAR "OBJCXX")
# Set a variable in the cache so that CMakeCXXCompiler.cmake.in can determine
# whether the Objective-C++ compiler settings are active. This settings allows that file
# to set the correct file extensions for the C++ language.
if(CMAKE_OBJCXX_COMPILER)
set(CMAKE_OBJCXX_ENABLED ON CACHE INTERNAL "")
endif()
set(CMAKE_OBJCXX_COMPILER "@CMAKE_OBJCXX_COMPILER@")
set(CMAKE_OBJCXX_COMPILER_ARG1 "@CMAKE_OBJCXX_COMPILER_ARG1@")
set(CMAKE_OBJCXX_COMPILER_ID "@CMAKE_OBJCXX_COMPILER_ID@")
set(CMAKE_OBJCXX_COMPILER_VERSION "@CMAKE_OBJCXX_COMPILER_VERSION@")
set(CMAKE_OBJCXX_PLATFORM_ID "@CMAKE_OBJCXX_PLATFORM_ID@")
set(CMAKE_OBJCXX_SIMULATE_ID "@CMAKE_OBJCXX_SIMULATE_ID@")
set(CMAKE_OBJCXX_SIMULATE_VERSION "@CMAKE_OBJCXX_SIMULATE_VERSION@")
set(CMAKE_AR "@CMAKE_AR@")
set(CMAKE_RANLIB "@CMAKE_RANLIB@")
set(CMAKE_LINKER "@CMAKE_LINKER@")
set(CMAKE_OBJCXX_COMPILER_IS_GNUCC @CMAKE_OBJCXX_COMPILER_IS_GNUCC@)
set(CMAKE_OBJCXX_COMPILER_LOADED 1)
set(CMAKE_OBJCXX_COMPILER_WORKS @CMAKE_OBJCXX_COMPILER_WORKS@)
set(CMAKE_OBJCXX_ABI_COMPILED @CMAKE_OBJCXX_ABI_COMPILED@)
set(CMAKE_OBJCXX_COMPILER_ENV_VAR "OBJCXX")
set(CMAKE_OBJCXX_COMPILER_ID_RUN 1)
if(CMAKE_OBJC_ENABLED)
set(CMAKE_OBJCXX_SOURCE_FILE_EXTENSIONS M;mm)
else()
set(CMAKE_OBJCXX_SOURCE_FILE_EXTENSIONS M;m;mm)
endif()
set(CMAKE_OBJCXX_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)
set(CMAKE_OBJCXX_LINKER_PREFERENCE 15)
# Save compiler ABI information.
set(CMAKE_OBJCXX_SIZEOF_DATA_PTR "@CMAKE_OBJCXX_SIZEOF_DATA_PTR@")
set(CMAKE_OBJCXX_COMPILER_ABI "@CMAKE_OBJCXX_COMPILER_ABI@")
set(CMAKE_OBJCXX_LIBRARY_ARCHITECTURE "@CMAKE_OBJCXX_LIBRARY_ARCHITECTURE@")
if(CMAKE_OBJCXX_SIZEOF_DATA_PTR)
set(CMAKE_SIZEOF_VOID_P "${CMAKE_OBJCXX_SIZEOF_DATA_PTR}")
endif()
if(CMAKE_OBJCXX_COMPILER_ABI)
set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_OBJCXX_COMPILER_ABI}")
endif()
if(CMAKE_OBJCXX_LIBRARY_ARCHITECTURE)
set(CMAKE_LIBRARY_ARCHITECTURE "@CMAKE_OBJCXX_LIBRARY_ARCHITECTURE@")
endif()
@CMAKE_OBJCXX_SYSROOT_FLAG_CODE@
@CMAKE_OBJCXX_OSX_DEPLOYMENT_TARGET_FLAG_CODE@
set(CMAKE_OBJCXX_IMPLICIT_LINK_LIBRARIES "@CMAKE_OBJCXX_IMPLICIT_LINK_LIBRARIES@")
set(CMAKE_OBJCXX_IMPLICIT_LINK_DIRECTORIES "@CMAKE_OBJCXX_IMPLICIT_LINK_DIRECTORIES@")
set(CMAKE_OBJCXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "@CMAKE_OBJCXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES@")
#ifndef __cplusplus
# error "A C compiler has been selected for Objective-C++."
#endif
/*--------------------------------------------------------------------------*/
#include "CMakeCompilerABI.h"
/*--------------------------------------------------------------------------*/
int main(int argc, char *argv[])
{
int require = 0;
require += info_sizeof_dptr[argc];
#if defined(ABI_ID)
require += info_abi[argc];
#endif
(void)argv;
return require;
}
#ifndef __cplusplus
# error "Selected C compiler for Objective-C++."
#endif
#if defined(__clang__)
# if defined(__apple_build_version__)
# define COMPILER_ID "AppleClang"
# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__)
# else
# define COMPILER_ID "Clang"
# endif
# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
# define COMPILER_VERSION_MINOR DEC(__clang_minor__)
# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
#elif defined(__GNUC__)
# define COMPILER_ID "GNU"
# define COMPILER_VERSION_MAJOR DEC(__GNUC__)
# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__)
# if defined(__GNUC_PATCHLEVEL__)
# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
# endif
#else /* unknown compiler */
# define COMPILER_ID ""
#endif
/* Construct the string literal in pieces to prevent the source from
getting matched. Store it in a pointer rather than an array
because some compilers will just produce instructions to fill the
array rather than assigning a pointer to a static array. */
char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
#ifdef SIMULATE_ID
char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
#endif
@CMAKE_OBJCXX_COMPILER_ID_PLATFORM_CONTENT@
/*--------------------------------------------------------------------------*/
int main(int argc, char* argv[])
{
int require = 0;
require += info_compiler[argc];
require += info_platform[argc];
#ifdef COMPILER_VERSION_MAJOR
require += info_version[argc];
#endif
require += info_arch[argc];
#ifdef COMPILER_VERSION_MAJOR
require += info_version[argc];
#endif
#ifdef SIMULATE_ID
require += info_simulate[argc];
#endif
#ifdef SIMULATE_VERSION_MAJOR
require += info_simulate_version[argc];
#endif
(void)argv;
return require;
}
#=============================================================================
# Copyright 2004-2014 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.)
# This file sets the basic flags for the Objective-C language in CMake.
# It also loads the available platform file for the system-compiler
# if it exists.
# It also loads a system - compiler - processor (or target hardware)
# specific file, which is mainly useful for crosscompiling and embedded systems.
set(CMAKE_OBJCXX_OUTPUT_EXTENSION .o)
set(_INCLUDED_FILE 0)
# Load compiler-specific information.
if(CMAKE_OBJCXX_COMPILER_ID)
include(Compiler/${CMAKE_OBJCXX_COMPILER_ID}-OBJCXX OPTIONAL)
endif()
set(CMAKE_BASE_NAME)
get_filename_component(CMAKE_BASE_NAME "${CMAKE_OBJCXX_COMPILER}" NAME_WE)
if(CMAKE_OBJCXX_COMPILER_IS_GNUCC)
set(CMAKE_BASE_NAME gcc)
endif()
# load a hardware specific file, mostly useful for embedded compilers
if(CMAKE_SYSTEM_PROCESSOR)
if(CMAKE_OBJCXX_COMPILER_ID)
include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_OBJCXX_COMPILER_ID}-OBJCXX-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE)
endif()
if (NOT _INCLUDED_FILE)
include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL)
endif ()
endif()
# load the system- and compiler specific files
if(CMAKE_OBJCXX_COMPILER_ID)
include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_OBJCXX_COMPILER_ID}-OBJCXX
OPTIONAL RESULT_VARIABLE _INCLUDED_FILE)
endif()
if (NOT _INCLUDED_FILE)
include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}
OPTIONAL RESULT_VARIABLE _INCLUDED_FILE)
endif ()
# We specify the compiler information in the system file for some
# platforms, but this language may not have been enabled when the file
# was first included. Include it again to get the language info.
# Remove this when all compiler info is removed from system files.
if (NOT _INCLUDED_FILE)
include(Platform/${CMAKE_SYSTEM_NAME} OPTIONAL)
endif ()
if(CMAKE_OBJCXX_SIZEOF_DATA_PTR)
foreach(f ${CMAKE_OBJCXX_ABI_FILES})
include(${f})
endforeach()
unset(CMAKE_OBJCXX_ABI_FILES)
endif()
# This should be included before the _INIT variables are
# used to initialize the cache. Since the rule variables
# have if blocks on them, users can still define them here.
# But, it should still be after the platform file so changes can
# be made to those values.
if(CMAKE_USER_MAKE_RULES_OVERRIDE)
# Save the full path of the file so try_compile can use it.
include(${CMAKE_USER_MAKE_RULES_OVERRIDE} RESULT_VARIABLE _override)
set(CMAKE_USER_MAKE_RULES_OVERRIDE "${_override}")
endif()
if(CMAKE_USER_MAKE_RULES_OVERRIDE_OBJCXX)
# Save the full path of the file so try_compile can use it.
include(${CMAKE_USER_MAKE_RULES_OVERRIDE_OBJCXX} RESULT_VARIABLE _override)
set(CMAKE_USER_MAKE_RULES_OVERRIDE_OBJCXX "${_override}")
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_OBJCXX_FLAGS ${CMAKE_SHARED_LIBRARY_OBJCXX_FLAGS})
set(CMAKE_SHARED_MODULE_CREATE_OBJCXX_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_OBJCXX_FLAGS})
endif()
set(CMAKE_OBJCXX_FLAGS_INIT "$ENV{OBJCXXCFLAGS} ${CMAKE_OBJCXX_FLAGS_INIT}")
# avoid just having a space as the initial value for the cache
if(CMAKE_OBJCXX_FLAGS_INIT STREQUAL " ")
set(CMAKE_OBJCXX_FLAGS_INIT)
endif()
set (CMAKE_OBJCXX_FLAGS "${CMAKE_OBJCXX_FLAGS_INIT}" CACHE STRING
"Flags used by the compiler during all build types.")
if(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
# default build type is none
if(NOT CMAKE_NO_BUILD_TYPE)
set (CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE_INIT} CACHE STRING
"Choose the type of build, options are: None(CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.")
endif()
set (CMAKE_OBJCXX_FLAGS_DEBUG "${CMAKE_OBJCXX_FLAGS_DEBUG_INIT}" CACHE STRING
"Flags used by the compiler during debug builds.")
set (CMAKE_OBJCXX_FLAGS_MINSIZEREL "${CMAKE_OBJCXX_FLAGS_MINSIZEREL_INIT}" CACHE STRING
"Flags used by the compiler during release builds for minimum size.")
set (CMAKE_OBJCXX_FLAGS_RELEASE "${CMAKE_OBJCXX_FLAGS_RELEASE_INIT}" CACHE STRING
"Flags used by the compiler during release builds.")
set (CMAKE_OBJCXX_FLAGS_RELWITHDEBINFO "${CMAKE_OBJCXX_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING
"Flags used by the compiler during release builds with debug info.")
endif()
if(CMAKE_OBJCXX_STANDARD_LIBRARIES_INIT)
set(CMAKE_OBJCXX_STANDARD_LIBRARIES "${CMAKE_OBJCXX_STANDARD_LIBRARIES_INIT}"
CACHE STRING "Libraries linked by default with all C applications.")
mark_as_advanced(CMAKE_OBJCXX_STANDARD_LIBRARIES)
endif()
include(CMakeCommonLanguageInclude)
# now define the following rule variables
# CMAKE_OBJCXX_CREATE_SHARED_LIBRARY
# CMAKE_OBJCXX_CREATE_SHARED_MODULE
# CMAKE_OBJCXX_COMPILE_OBJECT
# CMAKE_OBJCXX_LINK_EXECUTABLE
# variables supplied by the generator at use time
# <TARGET>
# <TARGET_BASE> the target without the suffix
# <OBJECTS>
# <OBJECT>
# <LINK_LIBRARIES>
# <FLAGS>
# <LINK_FLAGS>
# Objective-C compiler information
# <CMAKE_OBJCXX_COMPILER>
# <CMAKE_SHARED_LIBRARY_CREATE_OBJCXX_FLAGS>
# <CMAKE_SHARED_MODULE_CREATE_OBJCXX_FLAGS>
# <CMAKE_OBJCXX_LINK_FLAGS>
# Static library tools
# <CMAKE_AR>
# <CMAKE_RANLIB>
# create an OBJCXX shared library
if(NOT CMAKE_OBJCXX_CREATE_SHARED_LIBRARY)
set(CMAKE_OBJCXX_CREATE_SHARED_LIBRARY
"<CMAKE_OBJCXX_COMPILER> <CMAKE_SHARED_LIBRARY_OBJCXX_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_OBJCXX_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
endif()
# create an OBJCXX shared module just copy the shared library rule
if(NOT CMAKE_OBJCXX_CREATE_SHARED_MODULE)
set(CMAKE_OBJCXX_CREATE_SHARED_MODULE ${CMAKE_OBJCXX_CREATE_SHARED_LIBRARY})
endif()
# Create a static archive incrementally for large object file counts.
# If CMAKE_OBJCXX_CREATE_STATIC_LIBRARY is set it will override these.
if(NOT DEFINED CMAKE_OBJCXX_ARCHIVE_CREATE)
set(CMAKE_OBJCXX_ARCHIVE_CREATE "<CMAKE_LIBTOOL> -static -o <TARGET> <LINK_FLAGS> <OBJECTS>")
endif()
if(NOT DEFINED CMAKE_OBJCXX_ARCHIVE_APPEND)
set(CMAKE_OBJCXX_ARCHIVE_APPEND "<CMAKE_LIBTOOL> -static -o <TARGET> <LINK_FLAGS> <TARGET> <OBJECTS>")
endif()
if(NOT DEFINED CMAKE_OBJCXX_ARCHIVE_FINISH)
set(CMAKE_OBJCXX_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>")
endif()
# compile an Objective-C++ file into an object file
if(NOT CMAKE_OBJCXX_COMPILE_OBJECT)
set(CMAKE_OBJCXX_COMPILE_OBJECT
"<CMAKE_OBJCXX_COMPILER> <DEFINES> <FLAGS> -o <OBJECT> -c <SOURCE>")
endif()
if(NOT CMAKE_OBJCXX_LINK_EXECUTABLE)
set(CMAKE_OBJCXX_LINK_EXECUTABLE
"<CMAKE_OBJCXX_COMPILER> <FLAGS> <CMAKE_OBJCXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
endif()
if(NOT CMAKE_EXECUTABLE_RUNTIME_OBJCXX_FLAG)
set(CMAKE_EXECUTABLE_RUNTIME_OBJCXX_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_OBJCXX_FLAG})
endif()
if(NOT CMAKE_EXECUTABLE_RUNTIME_OBJCXX_FLAG_SEP)
set(CMAKE_EXECUTABLE_RUNTIME_OBJCXX_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_OBJCXX_FLAG_SEP})
endif()
if(NOT CMAKE_EXECUTABLE_RPATH_LINK_OBJCXX_FLAG)
set(CMAKE_EXECUTABLE_RPATH_LINK_OBJCXX_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_OBJCXX_FLAG})
endif()
mark_as_advanced(
CMAKE_OBJCXX_FLAGS
CMAKE_OBJCXX_FLAGS_DEBUG
CMAKE_OBJCXX_FLAGS_MINSIZEREL
CMAKE_OBJCXX_FLAGS_RELEASE
CMAKE_OBJCXX_FLAGS_RELWITHDEBINFO
)
set(CMAKE_OBJCXX_INFORMATION_LOADED 1)
#=============================================================================
# Copyright 2003-2014 Kitware, Inc.