summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt20
-rw-r--r--Modules/Platform/Darwin.cmake5
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/cmDocumentVariables.cxx2
-rw-r--r--Source/cmLocalGenerator.cxx32
-rw-r--r--Source/cmMakefileTargetGenerator.cxx14
-rw-r--r--Source/cmMakefileTargetGenerator.h2
-rw-r--r--Tests/CMakeLib/CMakeLists.txt2
-rw-r--r--Tests/CMakeLists.txt37
-rw-r--r--Tests/IncludeDirectories/SystemIncludeDirectories/CMakeLists.txt28
-rw-r--r--Tests/IncludeDirectories/SystemIncludeDirectories/imported_consumer.cpp7
-rw-r--r--Tests/IncludeDirectories/SystemIncludeDirectories/systemlib_header_only/systemlib.h16
12 files changed, 109 insertions, 58 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b64b6a9..5f3bc66 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -9,8 +9,7 @@
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
-cmake_minimum_required(VERSION 2.8.2 FATAL_ERROR)
-set(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required
+cmake_minimum_required(VERSION 2.8.4 FATAL_ERROR)
if(POLICY CMP0025)
cmake_policy(SET CMP0025 NEW)
endif()
@@ -196,15 +195,8 @@ mark_as_advanced(CMAKE_USE_FOLDERS)
macro(CMAKE_SET_TARGET_FOLDER tgt folder)
if(CMAKE_USE_FOLDERS)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
-
- # Really, I just want this to be an "if(TARGET ${tgt})" ...
- # but I'm not sure that our min req'd., CMake 2.4.5 can handle
- # that... so I'm just activating this for now, with a version
- # compare, and only for MSVC builds.
- if(MSVC)
- if(NOT ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.8)
- set_property(TARGET "${tgt}" PROPERTY FOLDER "${folder}")
- endif()
+ if(MSVC AND TARGET ${tgt})
+ set_property(TARGET "${tgt}" PROPERTY FOLDER "${folder}")
endif()
else()
set_property(GLOBAL PROPERTY USE_FOLDERS OFF)
@@ -326,11 +318,7 @@ macro (CMAKE_BUILD_UTILITIES)
#---------------------------------------------------------------------
# Build or use system libarchive for CMake and CTest.
if(CMAKE_USE_SYSTEM_LIBARCHIVE)
- if(EXISTS ${CMAKE_ROOT}/Modules/FindLibArchive.cmake) # added in 2.8.3
- find_package(LibArchive)
- else()
- include(${CMake_SOURCE_DIR}/Modules/FindLibArchive.cmake)
- endif()
+ find_package(LibArchive)
if(NOT LibArchive_FOUND)
message(FATAL_ERROR "CMAKE_USE_SYSTEM_LIBARCHIVE is ON but LibArchive is not found!")
endif()
diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake
index 72844b5..8ab3e2c 100644
--- a/Modules/Platform/Darwin.cmake
+++ b/Modules/Platform/Darwin.cmake
@@ -268,6 +268,11 @@ set(CMAKE_C_CREATE_MACOSX_FRAMEWORK
set(CMAKE_CXX_CREATE_MACOSX_FRAMEWORK
"<CMAKE_CXX_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <LINK_FLAGS> -o <TARGET> <SONAME_FLAG> <TARGET_INSTALLNAME_DIR><TARGET_SONAME> <OBJECTS> <LINK_LIBRARIES>")
+# Set default framework search path flag for languages known to use a
+# preprocessor that may find headers in frameworks.
+set(CMAKE_C_FRAMEWORK_SEARCH_FLAG -F)
+set(CMAKE_CXX_FRAMEWORK_SEARCH_FLAG -F)
+set(CMAKE_Fortran_FRAMEWORK_SEARCH_FLAG -F)
# default to searching for frameworks first
if(NOT DEFINED CMAKE_FIND_FRAMEWORK)
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 6298218..0d10c10 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 20131009)
+set(CMake_VERSION_TWEAK 20131015)
#set(CMake_VERSION_RC 1)
diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx
index 58634ea..dbe1b04 100644
--- a/Source/cmDocumentVariables.cxx
+++ b/Source/cmDocumentVariables.cxx
@@ -1977,6 +1977,8 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
cmProperty::VARIABLE,0,0);
cm->DefineProperty("CMAKE_<LANG>_FLAGS_RELWITHDEBINFO_INIT",
cmProperty::VARIABLE,0,0);
+ cm->DefineProperty("CMAKE_<LANG>_FRAMEWORK_SEARCH_FLAG",
+ cmProperty::VARIABLE,0,0);
cm->DefineProperty("CMAKE_<LANG>_INFORMATION_LOADED",
cmProperty::VARIABLE,0,0);
cm->DefineProperty("CMAKE_<LANG>_LINK_FLAGS",
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 9174e26..3dde19f 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1253,6 +1253,12 @@ std::string cmLocalGenerator::GetIncludeFlags(
sysIncludeFlag = this->Makefile->GetDefinition(sysFlagVar.c_str());
}
+ std::string fwSearchFlagVar = "CMAKE_";
+ fwSearchFlagVar += lang;
+ fwSearchFlagVar += "_FRAMEWORK_SEARCH_FLAG";
+ const char* fwSearchFlag =
+ this->Makefile->GetDefinition(fwSearchFlagVar.c_str());
+
bool flagUsed = false;
std::set<cmStdString> emitted;
#ifdef __APPLE__
@@ -1261,7 +1267,7 @@ std::string cmLocalGenerator::GetIncludeFlags(
std::vector<std::string>::const_iterator i;
for(i = includes.begin(); i != includes.end(); ++i)
{
- if(this->Makefile->IsOn("APPLE")
+ if(fwSearchFlag && *fwSearchFlag && this->Makefile->IsOn("APPLE")
&& cmSystemTools::IsPathToFramework(i->c_str()))
{
std::string frameworkDir = *i;
@@ -1271,8 +1277,8 @@ std::string cmLocalGenerator::GetIncludeFlags(
{
OutputFormat format = forResponseFile? RESPONSE : SHELL;
includeFlags
- << "-F" << this->Convert(frameworkDir.c_str(),
- START_OUTPUT, format, true)
+ << fwSearchFlag << this->Convert(frameworkDir.c_str(),
+ START_OUTPUT, format, true)
<< " ";
}
continue;
@@ -1770,13 +1776,21 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries,
}
// Append the framework search path flags.
- std::vector<std::string> const& fwDirs = cli.GetFrameworkPaths();
- for(std::vector<std::string>::const_iterator fdi = fwDirs.begin();
- fdi != fwDirs.end(); ++fdi)
+ std::string fwSearchFlagVar = "CMAKE_";
+ fwSearchFlagVar += linkLanguage;
+ fwSearchFlagVar += "_FRAMEWORK_SEARCH_FLAG";
+ const char* fwSearchFlag =
+ this->Makefile->GetDefinition(fwSearchFlagVar.c_str());
+ if(fwSearchFlag && *fwSearchFlag)
{
- frameworkPath += "-F";
- frameworkPath += this->Convert(fdi->c_str(), NONE, SHELL, false);
- frameworkPath += " ";
+ std::vector<std::string> const& fwDirs = cli.GetFrameworkPaths();
+ for(std::vector<std::string>::const_iterator fdi = fwDirs.begin();
+ fdi != fwDirs.end(); ++fdi)
+ {
+ frameworkPath += fwSearchFlag;
+ frameworkPath += this->Convert(fdi->c_str(), NONE, SHELL, false);
+ frameworkPath += " ";
+ }
}
// Append the library search path flags.
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 42091e3..9ca9149 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -291,7 +291,7 @@ std::string cmMakefileTargetGenerator::GetFlags(const std::string &l)
// Add include directory flags.
this->LocalGenerator->
- AppendFlags(flags,this->GetFrameworkFlags().c_str());
+ AppendFlags(flags,this->GetFrameworkFlags(l).c_str());
// Add target-specific flags.
this->LocalGenerator->AddCompileOptions(flags, this->Target,
@@ -1518,13 +1518,21 @@ void cmMakefileTargetGenerator::WriteTargetDriverRule(const char* main_output,
}
//----------------------------------------------------------------------------
-std::string cmMakefileTargetGenerator::GetFrameworkFlags()
+std::string cmMakefileTargetGenerator::GetFrameworkFlags(std::string const& l)
{
if(!this->Makefile->IsOn("APPLE"))
{
return std::string();
}
+ std::string fwSearchFlagVar = "CMAKE_" + l + "_FRAMEWORK_SEARCH_FLAG";
+ const char* fwSearchFlag =
+ this->Makefile->GetDefinition(fwSearchFlagVar.c_str());
+ if(!(fwSearchFlag && *fwSearchFlag))
+ {
+ return std::string();
+ }
+
std::set<cmStdString> emitted;
#ifdef __APPLE__ /* don't insert this when crosscompiling e.g. to iphone */
emitted.insert("/System/Library/Frameworks");
@@ -1559,7 +1567,7 @@ std::string cmMakefileTargetGenerator::GetFrameworkFlags()
{
if(emitted.insert(*i).second)
{
- flags += "-F";
+ flags += fwSearchFlag;
flags += this->Convert(i->c_str(),
cmLocalGenerator::START_OUTPUT,
cmLocalGenerator::SHELL, true);
diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h
index f7a1e2e..ec2af1c 100644
--- a/Source/cmMakefileTargetGenerator.h
+++ b/Source/cmMakefileTargetGenerator.h
@@ -124,7 +124,7 @@ protected:
void DriveCustomCommands(std::vector<std::string>& depends);
// Return the a string with -F flags on apple
- std::string GetFrameworkFlags();
+ std::string GetFrameworkFlags(std::string const& l);
void AppendFortranFormatFlags(std::string& flags, cmSourceFile& source);
diff --git a/Tests/CMakeLib/CMakeLists.txt b/Tests/CMakeLib/CMakeLists.txt
index a831e30..070c9cc 100644
--- a/Tests/CMakeLib/CMakeLists.txt
+++ b/Tests/CMakeLib/CMakeLists.txt
@@ -12,7 +12,7 @@ set(CMakeLib_TESTS
testXMLSafe
)
-if(WIN32 AND NOT UNIX) # Just if(WIN32) when CMake >= 2.8.4 is required
+if(WIN32)
list(APPEND CMakeLib_TESTS
testVisualStudioSlnParser
)
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index f7b98da..0e0455c 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1985,12 +1985,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
"Process file.*foo.py.*Total LOC:.*13.*Percentage Coverage: 84.62.*"
ENVIRONMENT COVFILE=)
- # Use macro, not function so that build can still be driven by CMake 2.4.
- # After 2.6 is required, this could be a function without the extra 'set'
- # calls.
- #
- macro(add_config_tests cfg)
- set(cfg "${cfg}")
+ function(add_config_tests cfg)
set(base "${CMake_BINARY_DIR}/Tests/CTestConfig")
# Test -S script with a -C config arg to ctest:
@@ -2014,7 +2009,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
add_test(CTestConfig.Dashboard.${cfg} ${CMAKE_CMAKE_COMMAND}
-P "${base}/${cfg}-dashboard.cmake" -VV
)
- endmacro()
+ endfunction()
add_config_tests(Debug)
add_config_tests(MinSizeRel)
@@ -2165,15 +2160,12 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
set_tests_properties(CTestTestTimeout PROPERTIES
PASS_REGULAR_EXPRESSION "TestTimeout *\\.+ *\\*\\*\\*Timeout.*CheckChild *\\.+ *Passed")
- # this test only runs correctly if WORKING_DIRECTORY is honored.
- if (NOT CMAKE_VERSION VERSION_LESS "2.8.4")
- add_test(
- NAME CTestTestRerunFailed
- COMMAND ${CMAKE_CTEST_COMMAND} --rerun-failed)
- set_tests_properties(CTestTestRerunFailed PROPERTIES
- PASS_REGULAR_EXPRESSION "1/1 Test #1: TestTimeout" DEPENDS CTestTestTimeout
- WORKING_DIRECTORY ${CMake_BINARY_DIR}/Tests/CTestTestTimeout)
- endif ()
+ add_test(
+ NAME CTestTestRerunFailed
+ COMMAND ${CMAKE_CTEST_COMMAND} --rerun-failed)
+ set_tests_properties(CTestTestRerunFailed PROPERTIES
+ PASS_REGULAR_EXPRESSION "1/1 Test #1: TestTimeout" DEPENDS CTestTestTimeout
+ WORKING_DIRECTORY ${CMake_BINARY_DIR}/Tests/CTestTestTimeout)
configure_file(
"${CMake_SOURCE_DIR}/Tests/CTestTestZeroTimeout/test.cmake.in"
@@ -2234,20 +2226,11 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--output-log "${CMake_BINARY_DIR}/Tests/CTestTestFdSetSize/testOutput.log"
)
- # Use macro, not function so that build can still be driven by CMake 2.4.
- # After 2.6 is required, this could be a function without the extra 'set'
- # calls.
- #
- macro(add_failed_submit_test name source build in out log regex)
- # Have variables named source, build and drop_method because the
- # configure_file call expects those variables to be defined.
- #
- set(source "${source}")
- set(build "${build}")
+ function(add_failed_submit_test name source build in out log regex)
configure_file("${in}" "${out}" @ONLY)
add_test(${name} ${CMAKE_CTEST_COMMAND} -S "${out}" -V --output-log "${log}")
set_tests_properties(${name} PROPERTIES PASS_REGULAR_EXPRESSION "${regex}")
- endmacro()
+ endfunction()
set(regex "(Problems when submitting via S*CP")
set(regex "${regex}|Error message was: ")
diff --git a/Tests/IncludeDirectories/SystemIncludeDirectories/CMakeLists.txt b/Tests/IncludeDirectories/SystemIncludeDirectories/CMakeLists.txt
index aec6ff9..1f5c93b 100644
--- a/Tests/IncludeDirectories/SystemIncludeDirectories/CMakeLists.txt
+++ b/Tests/IncludeDirectories/SystemIncludeDirectories/CMakeLists.txt
@@ -17,3 +17,31 @@ target_include_directories(upstream SYSTEM PUBLIC
add_library(consumer consumer.cpp)
target_link_libraries(consumer upstream)
target_compile_options(consumer PRIVATE -Werror=unused-variable)
+
+add_library(iface IMPORTED INTERFACE)
+set_property(TARGET iface PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/systemlib_header_only")
+
+add_library(imported_consumer imported_consumer.cpp)
+target_link_libraries(imported_consumer iface)
+target_compile_options(imported_consumer PRIVATE -Werror=unused-variable)
+
+macro(do_try_compile error_option)
+ set(TC_ARGS
+ IFACE_TRY_COMPILE_${error_option}
+ "${CMAKE_CURRENT_BINARY_DIR}/try_compile_iface" "${CMAKE_CURRENT_SOURCE_DIR}/imported_consumer.cpp"
+ LINK_LIBRARIES iface
+ )
+ if (${error_option} STREQUAL WITH_ERROR)
+ list(APPEND TC_ARGS COMPILE_DEFINITIONS -Werror=unused-variable)
+ endif()
+ try_compile(${TC_ARGS})
+endmacro()
+
+do_try_compile(NO_ERROR)
+if (NOT IFACE_TRY_COMPILE_NO_ERROR)
+ message(SEND_ERROR "try_compile failed with imported target.")
+endif()
+do_try_compile(WITH_ERROR)
+if (NOT IFACE_TRY_COMPILE_WITH_ERROR)
+ message(SEND_ERROR "try_compile failed with imported target with error option.")
+endif()
diff --git a/Tests/IncludeDirectories/SystemIncludeDirectories/imported_consumer.cpp b/Tests/IncludeDirectories/SystemIncludeDirectories/imported_consumer.cpp
new file mode 100644
index 0000000..1dbe819
--- /dev/null
+++ b/Tests/IncludeDirectories/SystemIncludeDirectories/imported_consumer.cpp
@@ -0,0 +1,7 @@
+
+#include "systemlib.h"
+
+int main()
+{
+ return systemlib();
+}
diff --git a/Tests/IncludeDirectories/SystemIncludeDirectories/systemlib_header_only/systemlib.h b/Tests/IncludeDirectories/SystemIncludeDirectories/systemlib_header_only/systemlib.h
new file mode 100644
index 0000000..93622c4
--- /dev/null
+++ b/Tests/IncludeDirectories/SystemIncludeDirectories/systemlib_header_only/systemlib.h
@@ -0,0 +1,16 @@
+
+#ifndef SYSTEMLIB_H
+#define SYSTEMLIB_H
+
+int systemlib()
+{
+ return 0;
+}
+
+int unusedFunc()
+{
+ int unused;
+ return systemlib();
+}
+
+#endif