summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/command/FIND_XXX_ROOT.txt11
-rw-r--r--Help/command/foreach.rst3
-rw-r--r--Help/command/if.rst3
-rw-r--r--Help/command/list.rst3
-rw-r--r--Help/command/macro.rst56
-rw-r--r--Help/manual/cmake-variables.7.rst3
-rw-r--r--Help/variable/CMAKE_LANG_COMPILER_EXTERNAL_TOOLCHAIN.rst13
-rw-r--r--Help/variable/CMAKE_LANG_COMPILER_TARGET.rst11
-rw-r--r--Help/variable/CMAKE_SYSROOT.rst12
-rw-r--r--Modules/CMakeDetermineCCompiler.cmake6
-rw-r--r--Modules/CMakeDetermineCXXCompiler.cmake6
-rw-r--r--Modules/CMakeDetermineCompilerId.cmake2
-rw-r--r--Modules/CMakeFindBinUtils.cmake7
-rw-r--r--Modules/Compiler/Clang.cmake2
-rw-r--r--Modules/Compiler/GNU.cmake1
-rw-r--r--Modules/FindLATEX.cmake3
-rw-r--r--Modules/Platform/QNX.cmake3
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/cmComputeLinkInformation.cxx20
-rw-r--r--Source/cmCoreTryCompile.cxx35
-rw-r--r--Source/cmDocumentation.cxx27
-rw-r--r--Source/cmDocumentation.h2
-rw-r--r--Source/cmFindCommon.cxx15
-rw-r--r--Source/cmGlobalKdevelopGenerator.cxx2
-rw-r--r--Source/cmLocalGenerator.cxx51
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx2
-rw-r--r--Tests/BundleUtilities/CMakeLists.txt18
-rw-r--r--Tests/CustomCommand/CMakeLists.txt5
-rw-r--r--Tests/LinkDirectory/CMakeLists.txt6
-rw-r--r--Tests/MakeClean/ToClean/CMakeLists.txt1
-rw-r--r--Tests/Tutorial/Step6/MathFunctions/CMakeLists.txt4
-rw-r--r--Tests/Tutorial/Step7/MathFunctions/CMakeLists.txt4
-rw-r--r--Tests/Wrapping/CMakeLists.txt3
33 files changed, 273 insertions, 69 deletions
diff --git a/Help/command/FIND_XXX_ROOT.txt b/Help/command/FIND_XXX_ROOT.txt
index 407375a..7f80dcb 100644
--- a/Help/command/FIND_XXX_ROOT.txt
+++ b/Help/command/FIND_XXX_ROOT.txt
@@ -1,10 +1,17 @@
The CMake variable CMAKE_FIND_ROOT_PATH specifies one or more
directories to be prepended to all other search directories. This
effectively "re-roots" the entire search under given locations. By
-default it is empty. It is especially useful when cross-compiling to
+default it is empty.
+
+The :variable:`CMAKE_SYSROOT` variable can also be used to specify exactly one
+directory to use as a prefix. Setting :variable:`CMAKE_SYSROOT` also has other
+effects. See the documentation for that variable for more.
+
+These variables are especially useful when cross-compiling to
point to the root directory of the target environment and CMake will
search there too. By default at first the directories listed in
-CMAKE_FIND_ROOT_PATH and then the non-rooted directories will be
+CMAKE_FIND_ROOT_PATH are searched, then the :variable:`CMAKE_SYSROOT` directory is
+searched, and then the non-rooted directories will be
searched. The default behavior can be adjusted by setting
|CMAKE_FIND_ROOT_PATH_MODE_XXX|. This behavior can be manually
overridden on a per-call basis. By using CMAKE_FIND_ROOT_PATH_BOTH
diff --git a/Help/command/foreach.rst b/Help/command/foreach.rst
index 8f9710c..348ebd8 100644
--- a/Help/command/foreach.rst
+++ b/Help/command/foreach.rst
@@ -42,5 +42,6 @@ three types of this iteration:
Iterates over a precise list of items. The LISTS option names
list-valued variables to be traversed, including empty elements (an
-empty string is a zero-length list). The ITEMS option ends argument
+empty string is a zero-length list). (Note macro
+arguments are not variables.) The ITEMS option ends argument
parsing and includes all arguments following it in the iteration.
diff --git a/Help/command/if.rst b/Help/command/if.rst
index b879ae1..0279be7 100644
--- a/Help/command/if.rst
+++ b/Help/command/if.rst
@@ -166,7 +166,8 @@ major[.minor[.patch[.tweak]]]).
if(DEFINED <variable>)
True if the given variable is defined. It does not matter if the
-variable is true or false just if it has been set.
+variable is true or false just if it has been set. (Note macro
+arguments are not variables.)
::
diff --git a/Help/command/list.rst b/Help/command/list.rst
index f044dba..aeb1e94 100644
--- a/Help/command/list.rst
+++ b/Help/command/list.rst
@@ -50,7 +50,8 @@ propagation.
NOTES: A list in cmake is a ; separated group of strings. To create a
list the set command can be used. For example, set(var a b c d e)
creates a list with a;b;c;d;e, and set(var "a b c d e") creates a
-string or a list with one item in it.
+string or a list with one item in it. (Note macro arguments are not
+variables, and therefore cannot be used in LIST commands.)
When specifying index values, if <element index> is 0 or greater, it
is indexed from the beginning of the list, with 0 representing the
diff --git a/Help/command/macro.rst b/Help/command/macro.rst
index aa16352..258dc50 100644
--- a/Help/command/macro.rst
+++ b/Help/command/macro.rst
@@ -15,19 +15,53 @@ Define a macro named <name> that takes arguments named arg1 arg2 arg3
(...). Commands listed after macro, but before the matching endmacro,
are not invoked until the macro is invoked. When it is invoked, the
commands recorded in the macro are first modified by replacing formal
-parameters (${arg1}) with the arguments passed, and then invoked as
+parameters (``${arg1}``) with the arguments passed, and then invoked as
normal commands. In addition to referencing the formal parameters you
-can reference the values ${ARGC} which will be set to the number of
-arguments passed into the function as well as ${ARGV0} ${ARGV1}
-${ARGV2} ... which will have the actual values of the arguments
+can reference the values ``${ARGC}`` which will be set to the number of
+arguments passed into the function as well as ``${ARGV0}`` ``${ARGV1}``
+``${ARGV2}`` ... which will have the actual values of the arguments
passed in. This facilitates creating macros with optional arguments.
-Additionally ${ARGV} holds the list of all arguments given to the
-macro and ${ARGN} holds the list of arguments past the last expected
-argument. Note that the parameters to a macro and values such as ARGN
-are not variables in the usual CMake sense. They are string
-replacements much like the C preprocessor would do with a macro. If
-you want true CMake variables and/or better CMake scope control you
-should look at the function command.
+Additionally ``${ARGV}`` holds the list of all arguments given to the
+macro and ``${ARGN}`` holds the list of arguments past the last expected
+argument.
See the cmake_policy() command documentation for the behavior of
policies inside macros.
+
+Macro Argument Caveats
+^^^^^^^^^^^^^^^^^^^^^^
+
+Note that the parameters to a macro and values such as ``ARGN`` are
+not variables in the usual CMake sense. They are string
+replacements much like the C preprocessor would do with a macro.
+Therefore you will NOT be able to use commands like::
+
+ if(ARGV1) # ARGV1 is not a variable
+ foreach(loop_var IN LISTS ARGN) # ARGN is not a variable
+
+In the first case you can use ``if(${ARGV1})``, in the second case, you can
+use ``foreach(loop_var ${ARGN})`` but this will skip empty arguments.
+If you need to include them, you can use::
+
+ set(list_var "${ARGN}")
+ foreach(loop_var IN LISTS list_var)
+
+Note that if you have a variable with the same name in the scope from
+which the macro is called, using unreferenced names will use the
+existing variable instead of the arguments. For example::
+
+ macro(_BAR)
+ foreach(arg IN LISTS ARGN)
+ [...]
+ endforeach()
+ endmacro()
+
+ function(_FOO)
+ _bar(x y z)
+ endfunction()
+
+ _foo(a b c)
+
+Will loop over ``a;b;c`` and not over ``x;y;z`` as one might be expecting.
+If you want true CMake variables and/or better CMake scope control you
+should look at the function command.
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index 59e8064..dd82b40 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -91,6 +91,7 @@ Variables that Change Behavior
/variable/CMAKE_DISABLE_FIND_PACKAGE_PackageName
/variable/CMAKE_ERROR_DEPRECATED
/variable/CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION
+ /variable/CMAKE_SYSROOT
/variable/CMAKE_FIND_LIBRARY_PREFIXES
/variable/CMAKE_FIND_LIBRARY_SUFFIXES
/variable/CMAKE_FIND_PACKAGE_WARN_NO_MODULE
@@ -234,6 +235,8 @@ Variables for Languages
/variable/CMAKE_LANG_COMPILER_ID
/variable/CMAKE_LANG_COMPILER_LOADED
/variable/CMAKE_LANG_COMPILER
+ /variable/CMAKE_LANG_COMPILER_EXTERNAL_TOOLCHAIN
+ /variable/CMAKE_LANG_COMPILER_TARGET
/variable/CMAKE_LANG_COMPILER_VERSION
/variable/CMAKE_LANG_CREATE_SHARED_LIBRARY
/variable/CMAKE_LANG_CREATE_SHARED_MODULE
diff --git a/Help/variable/CMAKE_LANG_COMPILER_EXTERNAL_TOOLCHAIN.rst b/Help/variable/CMAKE_LANG_COMPILER_EXTERNAL_TOOLCHAIN.rst
new file mode 100644
index 0000000..86c0b0e
--- /dev/null
+++ b/Help/variable/CMAKE_LANG_COMPILER_EXTERNAL_TOOLCHAIN.rst
@@ -0,0 +1,13 @@
+CMAKE_<LANG>_COMPILER_EXTERNAL_TOOLCHAIN
+----------------------------------------
+
+The external toolchain for cross-compiling, if supported.
+
+Some compiler toolchains do not ship their own auxilliary utilities such as
+archivers and linkers. The compiler driver may support a command-line argument
+to specify the location of such tools. CMAKE_<LANG>_COMPILER_EXTERNAL_TOOLCHAIN
+may be set to a path to a path to the external toolchain and will be passed
+to the compiler driver if supported.
+
+This variable may only be set in a toolchain file specified by
+the ``CMAKE_TOOLCHAIN_FILE`` variable.
diff --git a/Help/variable/CMAKE_LANG_COMPILER_TARGET.rst b/Help/variable/CMAKE_LANG_COMPILER_TARGET.rst
new file mode 100644
index 0000000..7c8efee
--- /dev/null
+++ b/Help/variable/CMAKE_LANG_COMPILER_TARGET.rst
@@ -0,0 +1,11 @@
+CMAKE_<LANG>_COMPILER_TARGET
+----------------------------
+
+The target for cross-compiling, if supported.
+
+Some compiler drivers are inherently cross-compilers, such as clang and
+QNX qcc. These compiler drivers support a command-line argument to specify
+the target to cross-compile for.
+
+This variable may only be set in a toolchain file specified by
+the ``CMAKE_TOOLCHAIN_FILE`` variable.
diff --git a/Help/variable/CMAKE_SYSROOT.rst b/Help/variable/CMAKE_SYSROOT.rst
new file mode 100644
index 0000000..e42e63a
--- /dev/null
+++ b/Help/variable/CMAKE_SYSROOT.rst
@@ -0,0 +1,12 @@
+CMAKE_SYSROOT
+-------------
+
+Path to pass to the compiler in the ``--sysroot`` flag.
+
+The ``CMAKE_SYSROOT`` content is passed to the compiler in the ``--sysroot``
+flag, if supported. The path is also stripped from the RPATH/RUNPATH if
+necessary on installation. The ``CMAKE_SYSROOT`` is also used to prefix
+paths searched by the ``find_*`` commands.
+
+This variable may only be set in a toolchain file specified by
+the ``CMAKE_TOOLCHAIN_FILE`` variable.
diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake
index 0d47a60..438a98a 100644
--- a/Modules/CMakeDetermineCCompiler.cmake
+++ b/Modules/CMakeDetermineCCompiler.cmake
@@ -158,6 +158,12 @@ if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX)
get_filename_component(COMPILER_BASENAME "${CMAKE_C_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_C_COMPILER_ID}" MATCHES "Clang")
+ set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_C_COMPILER_TARGET}-)
+ elseif(COMPILER_BASENAME MATCHES "qcc(\\.exe)?$")
+ if(CMAKE_C_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
diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake
index e882189..5f9d9bf 100644
--- a/Modules/CMakeDetermineCXXCompiler.cmake
+++ b/Modules/CMakeDetermineCXXCompiler.cmake
@@ -156,6 +156,12 @@ if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX)
get_filename_component(COMPILER_BASENAME "${CMAKE_CXX_COMPILER}" NAME)
if (COMPILER_BASENAME MATCHES "^(.+-)(clan)?[gc]\\+\\+(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
+ elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
+ set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_CXX_COMPILER_TARGET}-)
+ elseif(COMPILER_BASENAME MATCHES "QCC(\\.exe)?$")
+ if(CMAKE_CXX_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
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index 7fa4534..efb06c0 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -85,7 +85,7 @@ endfunction()
#-----------------------------------------------------------------------------
# Function to write the compiler id source file.
function(CMAKE_DETERMINE_COMPILER_ID_WRITE lang src)
- find_file(src_in ${src}.in PATHS ${CMAKE_ROOT}/Modules ${CMAKE_MODULE_PATH} NO_DEFAULT_PATH)
+ find_file(src_in ${src}.in PATHS ${CMAKE_ROOT}/Modules ${CMAKE_MODULE_PATH} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
file(READ ${src_in} ID_CONTENT_IN)
unset(src_in CACHE)
string(CONFIGURE "${ID_CONTENT_IN}" ID_CONTENT_OUT @ONLY)
diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake
index 315d57e..829b6ff 100644
--- a/Modules/CMakeFindBinUtils.cmake
+++ b/Modules/CMakeFindBinUtils.cmake
@@ -43,7 +43,12 @@ if("${CMAKE_C_SIMULATE_ID}" STREQUAL "MSVC"
# in all other cases search for ar, ranlib, etc.
else()
-
+ if(CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN)
+ set(_CMAKE_TOOLCHAIN_LOCATION ${_CMAKE_TOOLCHAIN_LOCATION} ${CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN}/bin)
+ endif()
+ if(CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN)
+ set(_CMAKE_TOOLCHAIN_LOCATION ${_CMAKE_TOOLCHAIN_LOCATION} ${CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN}/bin)
+ endif()
find_program(CMAKE_AR NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ar${_CMAKE_TOOLCHAIN_SUFFIX} HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
find_program(CMAKE_RANLIB NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ranlib HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
diff --git a/Modules/Compiler/Clang.cmake b/Modules/Compiler/Clang.cmake
index 7d7be5c..055aad6 100644
--- a/Modules/Compiler/Clang.cmake
+++ b/Modules/Compiler/Clang.cmake
@@ -30,5 +30,7 @@ else()
set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE")
set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-isystem ")
set(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY "-fvisibility=")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_TARGET "-target ")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN "-gcc-toolchain ")
endmacro()
endif()
diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake
index 504704d..f01255c 100644
--- a/Modules/Compiler/GNU.cmake
+++ b/Modules/Compiler/GNU.cmake
@@ -30,6 +30,7 @@ macro(__compiler_gnu lang)
endif()
set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC")
set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_SYSROOT "--sysroot=")
# Older versions of gcc (< 4.5) contain a bug causing them to report a missing
# header file as a warning if depfiles are enabled, causing check_header_file
diff --git a/Modules/FindLATEX.cmake b/Modules/FindLATEX.cmake
index e78d5bf..62eedd6 100644
--- a/Modules/FindLATEX.cmake
+++ b/Modules/FindLATEX.cmake
@@ -104,8 +104,9 @@ find_program(DVIPDF_CONVERTER
if (WIN32)
find_program(PS2PDF_CONVERTER
- NAMES ps2pdf14.bat
+ NAMES ps2pdf14.bat ps2pdf
PATHS ${GHOSTSCRIPT_LIBRARY_PATH}
+ ${MIKTEX_BINARY_PATH}
)
else ()
find_program(PS2PDF_CONVERTER
diff --git a/Modules/Platform/QNX.cmake b/Modules/Platform/QNX.cmake
index 068799f..9afde05 100644
--- a/Modules/Platform/QNX.cmake
+++ b/Modules/Platform/QNX.cmake
@@ -16,6 +16,9 @@ set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":")
set(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,")
set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,")
set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic")
+# http://www.qnx.com/developers/docs/6.4.0/neutrino/utilities/q/qcc.html#examples
+set(CMAKE_C_COMPILE_OPTIONS_TARGET "-V")
+set(CMAKE_CXX_COMPILE_OPTIONS_TARGET "-V")
# Shared libraries with no builtin soname may not be linked safely by
# specifying the file path.
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 5adced0..9ec279e 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -2,5 +2,5 @@
set(CMake_VERSION_MAJOR 2)
set(CMake_VERSION_MINOR 8)
set(CMake_VERSION_PATCH 12)
-set(CMake_VERSION_TWEAK 20131119)
+set(CMake_VERSION_TWEAK 20131120)
#set(CMake_VERSION_RC 1)
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index d4644c3..3152c2a 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -1901,6 +1901,8 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs,
}
if(use_build_rpath || use_link_rpath)
{
+ std::string rootPath = this->Makefile->GetSafeDefinition("CMAKE_SYSROOT");
+ cmSystemTools::ConvertToUnixSlashes(rootPath);
std::vector<std::string> const& rdirs = this->GetRuntimeSearchPath();
for(std::vector<std::string>::const_iterator ri = rdirs.begin();
ri != rdirs.end(); ++ri)
@@ -1909,9 +1911,14 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs,
// support or if using the link path as an rpath.
if(use_build_rpath)
{
- if(emitted.insert(*ri).second)
+ std::string d = *ri;
+ if (!rootPath.empty() && d.find(rootPath) == 0)
{
- runtimeDirs.push_back(*ri);
+ d = d.substr(rootPath.size());
+ }
+ if(emitted.insert(d).second)
+ {
+ runtimeDirs.push_back(d);
}
}
else if(use_link_rpath)
@@ -1924,9 +1931,14 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs,
!cmSystemTools::IsSubDirectory(ri->c_str(), topSourceDir) &&
!cmSystemTools::IsSubDirectory(ri->c_str(), topBinaryDir))
{
- if(emitted.insert(*ri).second)
+ std::string d = *ri;
+ if (!rootPath.empty() && d.find(rootPath) == 0)
+ {
+ d = d.substr(rootPath.size());
+ }
+ if(emitted.insert(d).second)
{
- runtimeDirs.push_back(*ri);
+ runtimeDirs.push_back(d);
}
}
}
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 479a699..bbfc427 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -405,6 +405,41 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
flag += this->Makefile->GetSafeDefinition("CMAKE_OSX_DEPLOYMENT_TARGET");
cmakeFlags.push_back(flag);
}
+ if (const char *cxxDef
+ = this->Makefile->GetDefinition("CMAKE_CXX_COMPILER_TARGET"))
+ {
+ std::string flag="-DCMAKE_CXX_COMPILER_TARGET=";
+ flag += cxxDef;
+ cmakeFlags.push_back(flag);
+ }
+ if (const char *cDef
+ = this->Makefile->GetDefinition("CMAKE_C_COMPILER_TARGET"))
+ {
+ std::string flag="-DCMAKE_C_COMPILER_TARGET=";
+ flag += cDef;
+ cmakeFlags.push_back(flag);
+ }
+ if (const char *tcxxDef = this->Makefile->GetDefinition(
+ "CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN"))
+ {
+ std::string flag="-DCMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN=";
+ flag += tcxxDef;
+ cmakeFlags.push_back(flag);
+ }
+ if (const char *tcDef = this->Makefile->GetDefinition(
+ "CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN"))
+ {
+ std::string flag="-DCMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN=";
+ flag += tcDef;
+ cmakeFlags.push_back(flag);
+ }
+ if (const char *rootDef
+ = this->Makefile->GetDefinition("CMAKE_SYSROOT"))
+ {
+ std::string flag="-DCMAKE_SYSROOT=";
+ flag += rootDef;
+ cmakeFlags.push_back(flag);
+ }
if(this->Makefile->GetDefinition("CMAKE_POSITION_INDEPENDENT_CODE")!=0)
{
fprintf(fout, "set(CMAKE_POSITION_INDEPENDENT_CODE \"ON\")\n");
diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx
index 8029577..8e06a1c 100644
--- a/Source/cmDocumentation.cxx
+++ b/Source/cmDocumentation.cxx
@@ -195,24 +195,27 @@ bool cmDocumentation::PrintRequestedDocumentation(std::ostream& os)
void cmDocumentation::WarnFormFromFilename(
- cmDocumentation::RequestedHelpItem& request)
+ cmDocumentation::RequestedHelpItem& request, bool& result)
{
std::string ext = cmSystemTools::GetFilenameLastExtension(request.Filename);
ext = cmSystemTools::UpperCase(ext);
if ((ext == ".HTM") || (ext == ".HTML"))
{
request.HelpType = cmDocumentation::None;
+ result = true;
cmSystemTools::Message("Warning: HTML help format no longer supported");
}
else if (ext == ".DOCBOOK")
{
request.HelpType = cmDocumentation::None;
+ result = true;
cmSystemTools::Message("Warning: Docbook help format no longer supported");
}
// ".1" to ".9" should be manpages
else if ((ext.length()==2) && (ext[1] >='1') && (ext[1]<='9'))
{
request.HelpType = cmDocumentation::None;
+ result = true;
cmSystemTools::Message("Warning: Man help format no longer supported");
}
}
@@ -300,28 +303,28 @@ bool cmDocumentation::CheckOptions(int argc, const char* const* argv,
help.HelpType = cmDocumentation::OneManual;
help.Argument = "cmake-properties.7";
GET_OPT_ARGUMENT(help.Filename);
- this->WarnFormFromFilename(help);
+ this->WarnFormFromFilename(help, result);
}
else if(strcmp(argv[i], "--help-policies") == 0)
{
help.HelpType = cmDocumentation::OneManual;
help.Argument = "cmake-policies.7";
GET_OPT_ARGUMENT(help.Filename);
- this->WarnFormFromFilename(help);
+ this->WarnFormFromFilename(help, result);
}
else if(strcmp(argv[i], "--help-variables") == 0)
{
help.HelpType = cmDocumentation::OneManual;
help.Argument = "cmake-variables.7";
GET_OPT_ARGUMENT(help.Filename);
- this->WarnFormFromFilename(help);
+ this->WarnFormFromFilename(help, result);
}
else if(strcmp(argv[i], "--help-modules") == 0)
{
help.HelpType = cmDocumentation::OneManual;
help.Argument = "cmake-modules.7";
GET_OPT_ARGUMENT(help.Filename);
- this->WarnFormFromFilename(help);
+ this->WarnFormFromFilename(help, result);
}
else if(strcmp(argv[i], "--help-custom-modules") == 0)
{
@@ -335,7 +338,7 @@ bool cmDocumentation::CheckOptions(int argc, const char* const* argv,
help.HelpType = cmDocumentation::OneManual;
help.Argument = "cmake-commands.7";
GET_OPT_ARGUMENT(help.Filename);
- this->WarnFormFromFilename(help);
+ this->WarnFormFromFilename(help, result);
}
else if(strcmp(argv[i], "--help-compatcommands") == 0)
{
@@ -368,42 +371,42 @@ bool cmDocumentation::CheckOptions(int argc, const char* const* argv,
GET_OPT_ARGUMENT(help.Argument);
GET_OPT_ARGUMENT(help.Filename);
help.Argument = cmSystemTools::LowerCase(help.Argument);
- this->WarnFormFromFilename(help);
+ this->WarnFormFromFilename(help, result);
}
else if(strcmp(argv[i], "--help-module") == 0)
{
help.HelpType = cmDocumentation::OneModule;
GET_OPT_ARGUMENT(help.Argument);
GET_OPT_ARGUMENT(help.Filename);
- this->WarnFormFromFilename(help);
+ this->WarnFormFromFilename(help, result);
}
else if(strcmp(argv[i], "--help-property") == 0)
{
help.HelpType = cmDocumentation::OneProperty;
GET_OPT_ARGUMENT(help.Argument);
GET_OPT_ARGUMENT(help.Filename);
- this->WarnFormFromFilename(help);
+ this->WarnFormFromFilename(help, result);
}
else if(strcmp(argv[i], "--help-policy") == 0)
{
help.HelpType = cmDocumentation::OnePolicy;
GET_OPT_ARGUMENT(help.Argument);
GET_OPT_ARGUMENT(help.Filename);
- this->WarnFormFromFilename(help);
+ this->WarnFormFromFilename(help, result);
}
else if(strcmp(argv[i], "--help-variable") == 0)
{
help.HelpType = cmDocumentation::OneVariable;
GET_OPT_ARGUMENT(help.Argument);
GET_OPT_ARGUMENT(help.Filename);
- this->WarnFormFromFilename(help);
+ this->WarnFormFromFilename(help, result);
}
else if(strcmp(argv[i], "--help-manual") == 0)
{
help.HelpType = cmDocumentation::OneManual;
GET_OPT_ARGUMENT(help.Argument);
GET_OPT_ARGUMENT(help.Filename);
- this->WarnFormFromFilename(help);
+ this->WarnFormFromFilename(help, result);
}
else if(strcmp(argv[i], "--help-command-list") == 0)
{
diff --git a/Source/cmDocumentation.h b/Source/cmDocumentation.h
index 209cc27..05c0442 100644
--- a/Source/cmDocumentation.h
+++ b/Source/cmDocumentation.h
@@ -137,7 +137,7 @@ private:
std::vector<RequestedHelpItem> RequestedHelpItems;
cmDocumentationFormatter Formatter;
- static void WarnFormFromFilename(RequestedHelpItem& request);
+ static void WarnFormFromFilename(RequestedHelpItem& request, bool& result);
};
#endif
diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx
index 7beeda0..8c42811 100644
--- a/Source/cmFindCommon.cxx
+++ b/Source/cmFindCommon.cxx
@@ -138,16 +138,27 @@ void cmFindCommon::RerootPaths(std::vector<std::string>& paths)
{
return;
}
+ const char* sysroot =
+ this->Makefile->GetDefinition("CMAKE_SYSROOT");
const char* rootPath =
this->Makefile->GetDefinition("CMAKE_FIND_ROOT_PATH");
- if((rootPath == 0) || (strlen(rootPath) == 0))
+ const bool noSysroot = !sysroot || !*sysroot;
+ const bool noRootPath = !rootPath || !*rootPath;
+ if(noSysroot && noRootPath)
{
return;
}
// Construct the list of path roots with no trailing slashes.
std::vector<std::string> roots;
- cmSystemTools::ExpandListArgument(rootPath, roots);
+ if (rootPath)
+ {
+ cmSystemTools::ExpandListArgument(rootPath, roots);
+ }
+ if (sysroot)
+ {
+ roots.push_back(sysroot);
+ }
for(std::vector<std::string>::iterator ri = roots.begin();
ri != roots.end(); ++ri)
{
diff --git a/Source/cmGlobalKdevelopGenerator.cxx b/Source/cmGlobalKdevelopGenerator.cxx
index 273d4bb..ab7db51 100644
--- a/Source/cmGlobalKdevelopGenerator.cxx
+++ b/Source/cmGlobalKdevelopGenerator.cxx
@@ -75,7 +75,7 @@ void cmGlobalKdevelopGenerator::Generate()
{
if (ti->second.GetType()==cmTarget::EXECUTABLE)
{
- executable = ti->second.GetProperty("LOCATION");
+ executable = ti->second.GetLocation(0);
break;
}
}
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 63ec576..d2784a9 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1043,11 +1043,38 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable,
// If this is the compiler then look for the extra variable
// _COMPILER_ARG1 which must be the first argument to the compiler
const char* compilerArg1 = 0;
+ const char* compilerTarget = 0;
+ const char* compilerOptionTarget = 0;
+ const char* compilerExternalToolchain = 0;
+ const char* compilerOptionExternalToolchain = 0;
+ const char* compilerSysroot = 0;
+ const char* compilerOptionSysroot = 0;
if(actualReplace == "CMAKE_${LANG}_COMPILER")
{
std::string arg1 = actualReplace + "_ARG1";
cmSystemTools::ReplaceString(arg1, "${LANG}", lang);
compilerArg1 = this->Makefile->GetDefinition(arg1.c_str());
+ compilerTarget
+ = this->Makefile->GetDefinition(
+ (std::string("CMAKE_") + lang + "_COMPILER_TARGET").c_str());
+ compilerOptionTarget
+ = this->Makefile->GetDefinition(
+ (std::string("CMAKE_") + lang +
+ "_COMPILE_OPTIONS_TARGET").c_str());
+ compilerExternalToolchain
+ = this->Makefile->GetDefinition(
+ (std::string("CMAKE_") + lang +
+ "_COMPILER_EXTERNAL_TOOLCHAIN").c_str());
+ compilerOptionExternalToolchain
+ = this->Makefile->GetDefinition(
+ (std::string("CMAKE_") + lang +
+ "_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN").c_str());
+ compilerSysroot
+ = this->Makefile->GetDefinition("CMAKE_SYSROOT");
+ compilerOptionSysroot
+ = this->Makefile->GetDefinition(
+ (std::string("CMAKE_") + lang +
+ "_COMPILE_OPTIONS_SYSROOT").c_str());
}
if(actualReplace.find("${LANG}") != actualReplace.npos)
{
@@ -1068,6 +1095,24 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable,
ret += " ";
ret += compilerArg1;
}
+ if (compilerTarget && compilerOptionTarget)
+ {
+ ret += " ";
+ ret += compilerOptionTarget;
+ ret += compilerTarget;
+ }
+ if (compilerExternalToolchain && compilerOptionExternalToolchain)
+ {
+ ret += " ";
+ ret += compilerOptionExternalToolchain;
+ ret += this->EscapeForShell(compilerExternalToolchain, true);
+ }
+ if (compilerSysroot && compilerOptionSysroot)
+ {
+ ret += " ";
+ ret += compilerOptionSysroot;
+ ret += this->EscapeForShell(compilerSysroot, true);
+ }
return ret;
}
return replace;
@@ -1462,6 +1507,8 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
return;
}
+ std::string rootPath = this->Makefile->GetSafeDefinition("CMAKE_SYSROOT");
+
std::vector<std::string> implicitDirs;
// Load implicit include directories for this language.
std::string impDirVar = "CMAKE_";
@@ -1474,7 +1521,9 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
for(std::vector<std::string>::const_iterator i = impDirVec.begin();
i != impDirVec.end(); ++i)
{
- emitted.insert(*i);
+ std::string d = rootPath + *i;
+ cmSystemTools::ConvertToUnixSlashes(d);
+ emitted.insert(d);
if (!stripImplicitInclDirs)
{
implicitDirs.push_back(*i);
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 30c3d73..2fd1016 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -482,6 +482,8 @@ cmVS7FlagTable cmLocalVisualStudio7GeneratorFlagTable[] =
{"AssemblerListingLocation", "Fa", "ASM List Location", "",
cmVS7FlagTable::UserValue},
+ {"ProgramDataBaseFileName", "Fd", "Program Database File Name", "",
+ cmVS7FlagTable::UserValue},
// boolean flags
{"BufferSecurityCheck", "GS", "Buffer security check", "TRUE", 0},
diff --git a/Tests/BundleUtilities/CMakeLists.txt b/Tests/BundleUtilities/CMakeLists.txt
index 5cc7071..3a1cf55 100644
--- a/Tests/BundleUtilities/CMakeLists.txt
+++ b/Tests/BundleUtilities/CMakeLists.txt
@@ -25,13 +25,11 @@ set_target_properties(shared shared2 framework PROPERTIES
# testbundleutils1 will load this at runtime
add_library(module1 MODULE module.cpp module.h)
set_target_properties(module1 PROPERTIES PREFIX "")
-get_target_property(module_loc module1 LOCATION)
target_link_libraries(module1 shared2)
# a bundle application
add_executable(testbundleutils1 MACOSX_BUNDLE testbundleutils1.cpp)
target_link_libraries(testbundleutils1 shared framework ${CMAKE_DL_LIBS})
-get_target_property(loc testbundleutils1 LOCATION)
set_target_properties(testbundleutils1 module1 PROPERTIES
INSTALL_RPATH "${CMAKE_CURRENT_BINARY_DIR}/testdir1"
@@ -40,8 +38,8 @@ set_target_properties(testbundleutils1 module1 PROPERTIES
# add custom target to install and test the app
add_custom_target(testbundleutils1_test ALL
COMMAND ${CMAKE_COMMAND}
- "-DINPUT=${loc}"
- "-DMODULE=${module_loc}"
+ "-DINPUT=$<TARGET_FILE:testbundleutils1>"
+ "-DMODULE=$<TARGET_FILE:module1>"
"-DINPUTDIR=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}"
"-DOUTPUTDIR=${CMAKE_CURRENT_BINARY_DIR}/testdir1"
-P "${CMAKE_CURRENT_SOURCE_DIR}/bundleutils.cmake"
@@ -58,13 +56,11 @@ add_dependencies(testbundleutils1_test testbundleutils1)
# testbundleutils2 will load this at runtime
add_library(module2 MODULE module.cpp module.h)
set_target_properties(module2 PROPERTIES PREFIX "")
-get_target_property(module_loc module2 LOCATION)
target_link_libraries(module2 shared2)
# a non-bundle application
add_executable(testbundleutils2 testbundleutils2.cpp)
target_link_libraries(testbundleutils2 shared framework ${CMAKE_DL_LIBS})
-get_target_property(loc testbundleutils2 LOCATION)
set_target_properties(testbundleutils2 module2 PROPERTIES
INSTALL_RPATH "${CMAKE_CURRENT_BINARY_DIR}/testdir2"
@@ -73,8 +69,8 @@ set_target_properties(testbundleutils2 module2 PROPERTIES
# add custom target to install and test the app
add_custom_target(testbundleutils2_test ALL
COMMAND ${CMAKE_COMMAND}
- "-DINPUT=${loc}"
- "-DMODULE=${module_loc}"
+ "-DINPUT=$<TARGET_FILE:testbundleutils2>"
+ "-DMODULE=$<TARGET_FILE:module2>"
"-DINPUTDIR=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}"
"-DOUTPUTDIR=${CMAKE_CURRENT_BINARY_DIR}/testdir2"
-P "${CMAKE_CURRENT_SOURCE_DIR}/bundleutils.cmake"
@@ -106,13 +102,11 @@ if(APPLE AND NOT CMAKE_SYSTEM_VERSION VERSION_LESS 9.0)
# testbundleutils1 will load this at runtime
add_library(module3 MODULE module.cpp module.h)
set_target_properties(module3 PROPERTIES PREFIX "" LINK_FLAGS "-Wl,-rpath,@loader_path/")
- get_target_property(module_loc module3 LOCATION)
target_link_libraries(module3 shared2-3)
# a non-bundle application
add_executable(testbundleutils3 testbundleutils3.cpp)
target_link_libraries(testbundleutils3 shared-3 framework-3 ${CMAKE_DL_LIBS})
- get_target_property(loc testbundleutils3 LOCATION)
set_target_properties(testbundleutils3 module3 PROPERTIES
LINK_FLAGS "-Wl,-rpath,@loader_path/")
@@ -120,8 +114,8 @@ if(APPLE AND NOT CMAKE_SYSTEM_VERSION VERSION_LESS 9.0)
# add custom target to install and test the app
add_custom_target(testbundleutils3_test ALL
COMMAND ${CMAKE_COMMAND}
- "-DINPUT=${loc}"
- "-DMODULE=${module_loc}"
+ "-DINPUT=$<TARGET_FILE:testbundleutils3>"
+ "-DMODULE=$<TARGET_FILE:module3>"
"-DINPUTDIR=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}"
"-DOUTPUTDIR=${CMAKE_CURRENT_BINARY_DIR}/testdir3"
-P "${CMAKE_CURRENT_SOURCE_DIR}/bundleutils.cmake"
diff --git a/Tests/CustomCommand/CMakeLists.txt b/Tests/CustomCommand/CMakeLists.txt
index 2408141..bbae387 100644
--- a/Tests/CustomCommand/CMakeLists.txt
+++ b/Tests/CustomCommand/CMakeLists.txt
@@ -29,9 +29,6 @@ set (EXECUTABLE_OUTPUT_PATH
# add the executable that will generate the file
add_executable(generator generator.cxx)
-get_target_property(generator_PATH generator LOCATION)
-message("Location ${generator_PATH}")
-
################################################################
#
# Test using a wrapper to wrap a header file
@@ -189,7 +186,7 @@ add_executable(CustomCommand
# generated source in a target.
add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/generated.c
DEPENDS generator
- COMMAND ${generator_PATH}
+ COMMAND generator
ARGS ${PROJECT_BINARY_DIR}/generated.c
)
diff --git a/Tests/LinkDirectory/CMakeLists.txt b/Tests/LinkDirectory/CMakeLists.txt
index 7356b27..b8d5a04 100644
--- a/Tests/LinkDirectory/CMakeLists.txt
+++ b/Tests/LinkDirectory/CMakeLists.txt
@@ -11,13 +11,13 @@ endif()
add_library(mylibA STATIC mylibA.c)
set_property(TARGET mylibA PROPERTY
ARCHIVE_OUTPUT_DIRECTORY "${LinkDirectory_BINARY_DIR}/External/lib")
-get_property(mylibA TARGET mylibA PROPERTY LOCATION)
+# get_property(mylibA TARGET mylibA PROPERTY LOCATION)
# Build a library into our build tree relative to the subproject build tree.
add_library(mylibB STATIC mylibB.c)
set_property(TARGET mylibB PROPERTY
ARCHIVE_OUTPUT_DIRECTORY "${LinkDirectory_BINARY_DIR}/lib")
-get_property(mylibB TARGET mylibB PROPERTY LOCATION)
+# get_property(mylibB TARGET mylibB PROPERTY LOCATION)
# Create a custom target to drive the subproject build.
include(ExternalProject)
@@ -38,7 +38,7 @@ ExternalProject_Add_Step(ExternalTarget cleanup
COMMAND ${CMAKE_COMMAND} -E remove_directory ${LinkDirectory_BINARY_DIR}/bin
DEPENDEES download
DEPENDERS configure
- DEPENDS ${mylibA} ${mylibB}
+ DEPENDS mylibA mylibB
"${LinkDirectory_BINARY_DIR}/External/CMakeLists.txt"
"${LinkDirectory_BINARY_DIR}/External/myexe.c"
)
diff --git a/Tests/MakeClean/ToClean/CMakeLists.txt b/Tests/MakeClean/ToClean/CMakeLists.txt
index 089fd13..d0e24ce 100644
--- a/Tests/MakeClean/ToClean/CMakeLists.txt
+++ b/Tests/MakeClean/ToClean/CMakeLists.txt
@@ -5,7 +5,6 @@ project(ToClean)
add_executable(toclean toclean.cxx)
# List some build-time-generated files.
-get_target_property(TOCLEAN_FILES toclean LOCATION)
set(TOCLEAN_FILES ${TOCLEAN_FILES}
"${ToClean_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/toclean.dir/toclean.cxx${CMAKE_CXX_OUTPUT_EXTENSION}")
diff --git a/Tests/Tutorial/Step6/MathFunctions/CMakeLists.txt b/Tests/Tutorial/Step6/MathFunctions/CMakeLists.txt
index 9961e69..70a35f6 100644
--- a/Tests/Tutorial/Step6/MathFunctions/CMakeLists.txt
+++ b/Tests/Tutorial/Step6/MathFunctions/CMakeLists.txt
@@ -1,13 +1,11 @@
# first we add the executable that generates the table
add_executable(MakeTable MakeTable.cxx)
-get_target_property(MakeTableLocation MakeTable LOCATION)
-
# add the command to generate the source code
add_custom_command (
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Table.h
DEPENDS MakeTable
- COMMAND ${MakeTableLocation}
+ COMMAND MakeTable
ARGS ${CMAKE_CURRENT_BINARY_DIR}/Table.h
)
diff --git a/Tests/Tutorial/Step7/MathFunctions/CMakeLists.txt b/Tests/Tutorial/Step7/MathFunctions/CMakeLists.txt
index 9961e69..70a35f6 100644
--- a/Tests/Tutorial/Step7/MathFunctions/CMakeLists.txt
+++ b/Tests/Tutorial/Step7/MathFunctions/CMakeLists.txt
@@ -1,13 +1,11 @@
# first we add the executable that generates the table
add_executable(MakeTable MakeTable.cxx)
-get_target_property(MakeTableLocation MakeTable LOCATION)
-
# add the command to generate the source code
add_custom_command (
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Table.h
DEPENDS MakeTable
- COMMAND ${MakeTableLocation}
+ COMMAND MakeTable
ARGS ${CMAKE_CURRENT_BINARY_DIR}/Table.h
)
diff --git a/Tests/Wrapping/CMakeLists.txt b/Tests/Wrapping/CMakeLists.txt
index 1dc7ffc..cbb28a1 100644
--- a/Tests/Wrapping/CMakeLists.txt
+++ b/Tests/Wrapping/CMakeLists.txt
@@ -89,9 +89,8 @@ set (FLTK_SRCS
fltk1.fl
)
add_executable(fakefluid fakefluid.cxx)
-get_target_property(FLUID_LOC fakefluid LOCATION)
set (FLTK_WRAP_UI "On")
-set (FLTK_FLUID_EXECUTABLE "${FLUID_LOC}")
+set (FLTK_FLUID_EXECUTABLE fakefluid)
fltk_wrap_ui (wraplibFLTK ${FLTK_SRCS})
add_library(wraplibFLTK ${wraplibFLTK_FLTK_UI_SRCS})
add_dependencies(wraplibFLTK fakefluid)