diff options
27 files changed, 116 insertions, 18 deletions
diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index 1d27a64..ac893c2 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -114,6 +114,7 @@ Properties on Targets /prop_tgt/AUTOUIC_OPTIONS /prop_tgt/AUTORCC /prop_tgt/AUTORCC_OPTIONS + /prop_tgt/BINARY_DIR /prop_tgt/BUILD_WITH_INSTALL_RPATH /prop_tgt/BUNDLE_EXTENSION /prop_tgt/BUNDLE @@ -244,6 +245,7 @@ Properties on Targets /prop_tgt/RUNTIME_OUTPUT_NAME_CONFIG /prop_tgt/RUNTIME_OUTPUT_NAME /prop_tgt/SKIP_BUILD_RPATH + /prop_tgt/SOURCE_DIR /prop_tgt/SOURCES /prop_tgt/SOVERSION /prop_tgt/STATIC_LIBRARY_FLAGS_CONFIG diff --git a/Help/prop_tgt/BINARY_DIR.rst b/Help/prop_tgt/BINARY_DIR.rst new file mode 100644 index 0000000..246f7e6 --- /dev/null +++ b/Help/prop_tgt/BINARY_DIR.rst @@ -0,0 +1,6 @@ +BINARY_DIR +---------- + +This read-only property reports the value of the +:variable:`CMAKE_CURRENT_BINARY_DIR` variable in the directory in which +the target was defined. diff --git a/Help/prop_tgt/SOURCE_DIR.rst b/Help/prop_tgt/SOURCE_DIR.rst new file mode 100644 index 0000000..b25813b --- /dev/null +++ b/Help/prop_tgt/SOURCE_DIR.rst @@ -0,0 +1,6 @@ +SOURCE_DIR +---------- + +This read-only property reports the value of the +:variable:`CMAKE_CURRENT_SOURCE_DIR` variable in the directory in which +the target was defined. diff --git a/Help/release/dev/target-directory-properties.rst b/Help/release/dev/target-directory-properties.rst new file mode 100644 index 0000000..5ab2938 --- /dev/null +++ b/Help/release/dev/target-directory-properties.rst @@ -0,0 +1,5 @@ +target-directory-properties +--------------------------- + +* The :prop_tgt:`SOURCE_DIR` and :prop_tgt:`BINARY_DIR` target properties + were introduced to allow project code to query where a target is defined. diff --git a/Modules/Compiler/MSVC-CXX-FeatureTests.cmake b/Modules/Compiler/MSVC-CXX-FeatureTests.cmake index fcedf3c..ad1d14b 100644 --- a/Modules/Compiler/MSVC-CXX-FeatureTests.cmake +++ b/Modules/Compiler/MSVC-CXX-FeatureTests.cmake @@ -3,6 +3,8 @@ # http://blogs.msdn.com/b/vcblog/archive/2013/06/28/c-11-14-stl-features-fixes-and-breaking-changes-in-vs-2013.aspx # http://blogs.msdn.com/b/vcblog/archive/2014/11/17/c-11-14-17-features-in-vs-2015-preview.aspx # http://www.visualstudio.com/en-us/news/vs2015-preview-vs.aspx +# http://blogs.msdn.com/b/vcblog/archive/2015/04/29/c-11-14-17-features-in-vs-2015-rc.aspx +# http://blogs.msdn.com/b/vcblog/archive/2015/06/19/c-11-14-17-features-in-vs-2015-rtm.aspx set(_cmake_oldestSupported "_MSC_VER >= 1600") @@ -10,10 +12,11 @@ set(_cmake_oldestSupported "_MSC_VER >= 1600") set(MSVC_2015 "_MSC_VER >= 1900") set(_cmake_feature_test_cxx_alignas "${MSVC_2015}") set(_cmake_feature_test_cxx_alignof "${MSVC_2015}") +set(_cmake_feature_test_cxx_attributes "${MSVC_2015}") +set(_cmake_feature_test_cxx_attribute_deprecated "${MSVC_2015}") set(_cmake_feature_test_cxx_binary_literals "${MSVC_2015}") +set(_cmake_feature_test_cxx_constexpr "${MSVC_2015}") set(_cmake_feature_test_cxx_decltype_auto "${MSVC_2015}") -# Digit separators are not available as of VS 2015 Preview, but a footnote -# says they will be available in the RTM. set(_cmake_feature_test_cxx_digit_separators "${MSVC_2015}") set(_cmake_feature_test_cxx_func_identifier "${MSVC_2015}") set(_cmake_feature_test_cxx_nonstatic_member_init "${MSVC_2015}") @@ -89,10 +92,7 @@ set(_cmake_feature_test_cxx_trailing_return_types "${MSVC_2010}") set(_cmake_feature_test_cxx_variadic_macros "${MSVC_2010}") # Currently unsupported: -# set(_cmake_feature_test_cxx_constexpr ) # set(_cmake_feature_test_cxx_relaxed_constexpr ) -# set(_cmake_feature_test_cxx_attributes ) -# set(_cmake_feature_test_cxx_attribute_deprecated ) # 'NSDMIs for aggregates' # set(_cmake_feature_test_cxx_aggregate_default_initializers ) # set(_cmake_feature_test_cxx_variable_templates ) diff --git a/Modules/FindBZip2.cmake b/Modules/FindBZip2.cmake index b479332..6af42dd 100644 --- a/Modules/FindBZip2.cmake +++ b/Modules/FindBZip2.cmake @@ -56,11 +56,13 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(BZip2 VERSION_VAR BZIP2_VERSION_STRING) if (BZIP2_FOUND) - include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake) + include(${CMAKE_CURRENT_LIST_DIR}/CheckSymbolExists.cmake) include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake) cmake_push_check_state() set(CMAKE_REQUIRED_QUIET ${BZip2_FIND_QUIETLY}) - CHECK_LIBRARY_EXISTS("${BZIP2_LIBRARIES}" BZ2_bzCompressInit "" BZIP2_NEED_PREFIX) + set(CMAKE_REQUIRED_INCLUDES ${BZIP2_INCLUDE_DIR}) + set(CMAKE_REQUIRED_LIBRARIES ${BZIP2_LIBRARIES}) + CHECK_SYMBOL_EXISTS(BZ2_bzCompressInit "bzlib.h" BZIP2_NEED_PREFIX) cmake_pop_check_state() endif () diff --git a/Modules/Platform/Darwin-AppleClang-C.cmake b/Modules/Platform/Darwin-AppleClang-C.cmake index 98971bb..3216b29 100644 --- a/Modules/Platform/Darwin-AppleClang-C.cmake +++ b/Modules/Platform/Darwin-AppleClang-C.cmake @@ -1 +1,6 @@ include(Platform/Darwin-Clang-C) +if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.2) + set(CMAKE_C_SYSTEM_FRAMEWORK_SEARCH_FLAG "-iframework ") +else() + unset(CMAKE_C_SYSTEM_FRAMEWORK_SEARCH_FLAG) +endif() diff --git a/Modules/Platform/Darwin-AppleClang-CXX.cmake b/Modules/Platform/Darwin-AppleClang-CXX.cmake index 4e9e7c1..3fedf8c 100644 --- a/Modules/Platform/Darwin-AppleClang-CXX.cmake +++ b/Modules/Platform/Darwin-AppleClang-CXX.cmake @@ -1 +1,6 @@ include(Platform/Darwin-Clang-CXX) +if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.2) + set(CMAKE_CXX_SYSTEM_FRAMEWORK_SEARCH_FLAG "-iframework ") +else() + unset(CMAKE_CXX_SYSTEM_FRAMEWORK_SEARCH_FLAG) +endif() diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index ebceff9..f5c693a 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 3) -set(CMake_VERSION_PATCH 20150721) +set(CMake_VERSION_PATCH 20150727) #set(CMake_VERSION_RC 1) diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx index 43d26f9..96ea77b 100644 --- a/Source/cmExportCommand.cxx +++ b/Source/cmExportCommand.cxx @@ -177,6 +177,12 @@ bool cmExportCommand this->SetError(e.str()); return false; } + if (target->GetType() == cmTarget::UTILITY) + { + this->SetError("given custom target \"" + *currentTarget + + "\" which may not be exported."); + return false; + } } else { diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 22114fd..8520e29 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2970,6 +2970,8 @@ const char *cmTarget::GetProperty(const std::string& prop, MAKE_STATIC_PROP(COMPILE_DEFINITIONS); MAKE_STATIC_PROP(IMPORTED); MAKE_STATIC_PROP(NAME); + MAKE_STATIC_PROP(BINARY_DIR); + MAKE_STATIC_PROP(SOURCE_DIR); MAKE_STATIC_PROP(SOURCES); #undef MAKE_STATIC_PROP if(specialProps.empty()) @@ -2982,6 +2984,8 @@ const char *cmTarget::GetProperty(const std::string& prop, specialProps.insert(propCOMPILE_DEFINITIONS); specialProps.insert(propIMPORTED); specialProps.insert(propNAME); + specialProps.insert(propBINARY_DIR); + specialProps.insert(propSOURCE_DIR); specialProps.insert(propSOURCES); } if(specialProps.count(prop)) @@ -3064,6 +3068,14 @@ const char *cmTarget::GetProperty(const std::string& prop, { return this->GetName().c_str(); } + else if (prop == propBINARY_DIR) + { + return this->GetMakefile()->GetCurrentBinaryDirectory(); + } + else if (prop == propSOURCE_DIR) + { + return this->GetMakefile()->GetCurrentSourceDirectory(); + } else if(prop == propSOURCES) { if (this->Internal->SourceEntries.empty()) diff --git a/Tests/BuildDepends/CMakeLists.txt b/Tests/BuildDepends/CMakeLists.txt index 2be59b6..7b7353c 100644 --- a/Tests/BuildDepends/CMakeLists.txt +++ b/Tests/BuildDepends/CMakeLists.txt @@ -69,6 +69,9 @@ file(WRITE ${BuildDepends_BINARY_DIR}/Project/link_depends_no_shared_exe.h "#define link_depends_no_shared_exe_value 0\n") set(link_depends_no_shared_check_txt ${BuildDepends_BINARY_DIR}/Project/link_depends_no_shared_check.txt) +file(WRITE ${BuildDepends_BINARY_DIR}/Project/object_depends.txt "0\n") +set(object_depends_check_txt ${BuildDepends_BINARY_DIR}/Project/object_depends_check.txt) + file(WRITE ${BuildDepends_BINARY_DIR}/Project/external.in "external original\n") file(WRITE ${BuildDepends_BINARY_DIR}/Project/multi1-in.txt "multi1-in original\n") file(WRITE ${BuildDepends_BINARY_DIR}/Project/multi2-stamp.txt "multi2-stamp original\n") @@ -246,6 +249,8 @@ file(WRITE ${BuildDepends_BINARY_DIR}/Project/zot_macro_tgt.hxx file(WRITE ${BuildDepends_BINARY_DIR}/Project/link_depends_no_shared_lib.h "#define link_depends_no_shared_lib_value 0\n") +file(WRITE ${BuildDepends_BINARY_DIR}/Project/object_depends.txt "1\n") + if(TEST_LINK_DEPENDS) file(WRITE ${TEST_LINK_DEPENDS} "2") endif() @@ -359,6 +364,20 @@ else() "Targets link_depends_no_shared_lib and link_depends_no_shared_exe not both built.") endif() +if(EXISTS "${object_depends_check_txt}") + file(STRINGS "${object_depends_check_txt}" object_depends_check LIMIT_COUNT 1) + if("${object_depends_check}" STREQUAL "1") + message(STATUS "object_depends exe is newer than object_depends.txt as expected.") + elseif(CMAKE_GENERATOR MATCHES "Visual Studio|Xcode") + message(STATUS "Known limitation: OBJECT_DEPENDS does not work on ${CMAKE_GENERATOR}") + else() + message(SEND_ERROR "Project did not rebuild properly: object_depends exe is not newer than object_depends.txt.") + endif() +else() + message(SEND_ERROR "Project did not rebuild properly. " + "object_depends exe and object_depends.txt are not both present.") +endif() + if(EXISTS ${BuildDepends_BINARY_DIR}/Project/external.out) file(STRINGS ${BuildDepends_BINARY_DIR}/Project/external.out external_out) if("${external_out}" STREQUAL "external changed") diff --git a/Tests/BuildDepends/Project/CMakeLists.txt b/Tests/BuildDepends/Project/CMakeLists.txt index 0db39c5..3aa57fc 100644 --- a/Tests/BuildDepends/Project/CMakeLists.txt +++ b/Tests/BuildDepends/Project/CMakeLists.txt @@ -182,3 +182,15 @@ if(TEST_MULTI3) set_property(SOURCE multi3-real.txt multi3-dummy.txt PROPERTY SYMBOLIC 1) add_custom_target(multi3 ALL DEPENDS multi3-real.txt) endif() + +add_executable(object_depends object_depends.cxx) +set_property(SOURCE object_depends.cxx PROPERTY OBJECT_DEPENDS + ${CMAKE_CURRENT_BINARY_DIR}/object_depends.txt) +add_custom_target(object_depends_check ALL + COMMAND ${CMAKE_COMMAND} + -Dexe=$<TARGET_FILE:object_depends> + -Dout=${CMAKE_CURRENT_BINARY_DIR}/object_depends_check.txt + -Dtxt=${CMAKE_CURRENT_BINARY_DIR}/object_depends.txt + -P ${CMAKE_CURRENT_SOURCE_DIR}/object_depends_check.cmake + ) +add_dependencies(object_depends_check object_depends) diff --git a/Tests/BuildDepends/Project/object_depends.cxx b/Tests/BuildDepends/Project/object_depends.cxx new file mode 100644 index 0000000..76e8197 --- /dev/null +++ b/Tests/BuildDepends/Project/object_depends.cxx @@ -0,0 +1 @@ +int main() { return 0; } diff --git a/Tests/BuildDepends/Project/object_depends_check.cmake b/Tests/BuildDepends/Project/object_depends_check.cmake new file mode 100644 index 0000000..e009892 --- /dev/null +++ b/Tests/BuildDepends/Project/object_depends_check.cmake @@ -0,0 +1,7 @@ +if(NOT EXISTS "${txt}" OR NOT EXISTS "${exe}") + file(REMOVE "${out}") +elseif("${exe}" IS_NEWER_THAN "${txt}") + file(WRITE "${out}" "1\n") +else() + file(WRITE "${out}" "0\n") +endif() diff --git a/Tests/CompileFeatures/CMakeLists.txt b/Tests/CompileFeatures/CMakeLists.txt index 3ba1e0a..a32138d 100644 --- a/Tests/CompileFeatures/CMakeLists.txt +++ b/Tests/CompileFeatures/CMakeLists.txt @@ -116,12 +116,6 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") cxx_deleted_functions cxx_nonstatic_member_init ) - else() - list(REMOVE_ITEM CXX_non_features - # The cxx_constexpr feature happens to work (for *this* testcase) - # with VS 2015, but they document only partial support. - cxx_constexpr - ) endif() endif() diff --git a/Tests/RunCMake/export/AppendExport-stderr.txt b/Tests/RunCMake/export/AppendExport-stderr.txt index 6e385d4..d71620e 100644 --- a/Tests/RunCMake/export/AppendExport-stderr.txt +++ b/Tests/RunCMake/export/AppendExport-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at AppendExport.cmake:8 \(export\): +CMake Error at AppendExport.cmake:[0-9]+ \(export\): export EXPORT signature does not recognise the APPEND option. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/export/AppendExport.cmake b/Tests/RunCMake/export/AppendExport.cmake index f36010b..2a99dfc 100644 --- a/Tests/RunCMake/export/AppendExport.cmake +++ b/Tests/RunCMake/export/AppendExport.cmake @@ -1,3 +1,4 @@ +enable_language(CXX) add_library(foo empty.cpp) export(TARGETS foo FILE "${CMAKE_CURRENT_BINARY_DIR}/foo.cmake") install(TARGETS foo EXPORT fooExport diff --git a/Tests/RunCMake/export/CMakeLists.txt b/Tests/RunCMake/export/CMakeLists.txt index be9d403..12cd3c7 100644 --- a/Tests/RunCMake/export/CMakeLists.txt +++ b/Tests/RunCMake/export/CMakeLists.txt @@ -1,3 +1,3 @@ cmake_minimum_required(VERSION 2.8.4) -project(${RunCMake_TEST}) +project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/export/CustomTarget-result.txt b/Tests/RunCMake/export/CustomTarget-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/export/CustomTarget-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/export/CustomTarget-stderr.txt b/Tests/RunCMake/export/CustomTarget-stderr.txt new file mode 100644 index 0000000..57a9af3 --- /dev/null +++ b/Tests/RunCMake/export/CustomTarget-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at CustomTarget.cmake:[0-9]+ \(export\): + export given custom target "CustomTarget" which may not be exported. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/export/CustomTarget.cmake b/Tests/RunCMake/export/CustomTarget.cmake new file mode 100644 index 0000000..4d2bf18 --- /dev/null +++ b/Tests/RunCMake/export/CustomTarget.cmake @@ -0,0 +1,2 @@ +add_custom_target(CustomTarget) +export(TARGETS CustomTarget FILE somefile.cmake) diff --git a/Tests/RunCMake/export/OldIface-stderr.txt b/Tests/RunCMake/export/OldIface-stderr.txt index afb4ae3..818c2cb 100644 --- a/Tests/RunCMake/export/OldIface-stderr.txt +++ b/Tests/RunCMake/export/OldIface-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at OldIface.cmake:8 \(export\): +CMake Error at OldIface.cmake:[0-9]+ \(export\): export EXPORT signature does not recognise the EXPORT_LINK_INTERFACE_LIBRARIES option. Call Stack \(most recent call first\): diff --git a/Tests/RunCMake/export/OldIface.cmake b/Tests/RunCMake/export/OldIface.cmake index 5fb8e25..833b023 100644 --- a/Tests/RunCMake/export/OldIface.cmake +++ b/Tests/RunCMake/export/OldIface.cmake @@ -1,3 +1,4 @@ +enable_language(CXX) add_library(foo empty.cpp) export(TARGETS foo FILE "${CMAKE_CURRENT_BINARY_DIR}/foo.cmake") install(TARGETS foo EXPORT fooExport diff --git a/Tests/RunCMake/export/RunCMakeTest.cmake b/Tests/RunCMake/export/RunCMakeTest.cmake index 4b04f18..6d0b7ca 100644 --- a/Tests/RunCMake/export/RunCMakeTest.cmake +++ b/Tests/RunCMake/export/RunCMakeTest.cmake @@ -1,5 +1,6 @@ include(RunCMake) +run_cmake(CustomTarget) run_cmake(TargetNotFound) run_cmake(AppendExport) run_cmake(OldIface) diff --git a/Tests/RunCMake/get_property/target_properties-stderr.txt b/Tests/RunCMake/get_property/target_properties-stderr.txt index d0981ac..6b3c6ca 100644 --- a/Tests/RunCMake/get_property/target_properties-stderr.txt +++ b/Tests/RunCMake/get_property/target_properties-stderr.txt @@ -3,4 +3,8 @@ get_property: --><-- get_target_property: -->value<-- get_property: -->value<-- get_target_property: -->gtp_val-NOTFOUND<-- -get_property: --><--$ +get_property: --><-- +get_target_property: -->(.*)/Tests/RunCMake/get_property<-- +get_property: -->(.*)/Tests/RunCMake/get_property<-- +get_target_property: -->(.*)/Tests/RunCMake/get_property/target_properties-build<-- +get_property: -->(.*)/Tests/RunCMake/get_property/target_properties-build<--$ diff --git a/Tests/RunCMake/get_property/target_properties.cmake b/Tests/RunCMake/get_property/target_properties.cmake index c5a141d..9ff833a 100644 --- a/Tests/RunCMake/get_property/target_properties.cmake +++ b/Tests/RunCMake/get_property/target_properties.cmake @@ -14,3 +14,5 @@ set_target_properties(tgt PROPERTIES empty "" custom value) check_target_property(tgt empty) check_target_property(tgt custom) check_target_property(tgt noexist) +check_target_property(tgt SOURCE_DIR) +check_target_property(tgt BINARY_DIR) |