This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake".
The branch, next has been updated via e4f32022c3506941edc52bf121740a527c7184f8 (commit) via e1f7ee3de71fc0e7a34bf05ec2cf4ec586ff9e32 (commit) via 9554e1013ef5d9971092ed0cd45daf59b8a6bd87 (commit) from 1197c43f2792bc89d82927abf0ab91a88b0974f2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e4f32022c3506941edc52bf121740a527c7184f8 commit e4f32022c3506941edc52bf121740a527c7184f8 Merge: 1197c43 e1f7ee3 Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Thu Aug 11 18:09:23 2011 -0400 Commit: CMake Topic Stage <kwro...@kitware.com> CommitDate: Thu Aug 11 18:09:23 2011 -0400 Merge topic 'generate_export_header' into next e1f7ee3 Test for compiler features, instead of for specific platforms. 9554e10 Split the deprecated available check from setting macro values. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e1f7ee3de71fc0e7a34bf05ec2cf4ec586ff9e32 commit e1f7ee3de71fc0e7a34bf05ec2cf4ec586ff9e32 Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Thu Aug 11 18:18:19 2011 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Thu Aug 11 19:06:23 2011 +0200 Test for compiler features, instead of for specific platforms. diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake index f690655..578d71f 100644 --- a/Modules/GenerateExportHeader.cmake +++ b/Modules/GenerateExportHeader.cmake @@ -115,6 +115,20 @@ include(CMakeParseArguments) include(CheckCXXCompilerFlag) + +# TODO: Install this macro separately? +macro(_check_cxx_compiler_attribute _ATTRIBUTE _RESULT) + check_cxx_source_compiles("${_ATTRIBUTE} int somefunc() { return 0; } int main() { return somefunc();}" ${_RESULT} + # Some compilers do not fail with a bad flag + FAIL_REGEX "unrecognized .*option" # GNU + FAIL_REGEX "ignoring unknown option" # MSVC + FAIL_REGEX "warning D9002" # MSVC, any lang + FAIL_REGEX "[Uu]nknown option" # HP + FAIL_REGEX "[Ww]arning: [Oo]ption" # SunPro + FAIL_REGEX "command option .* is not recognized" # XL + ) +endmacro() + macro(_test_compiler_hidden_visibility) if (CMAKE_COMPILER_IS_GNUCXX) @@ -141,15 +155,11 @@ macro(_test_compiler_hidden_visibility) endmacro() macro(_test_compiler_has_deprecated) - if (WIN32) - if (NOT ${CMAKE_CXX_COMPILER_ID} MATCHES Borland) - set(COMPILER_HAS_DEPRECATED TRUE) - endif() + _check_cxx_compiler_attribute("__declspec(deprecated)" COMPILER_HAS_DEPRECATED_DECLSPEC) + if(COMPILER_HAS_DEPRECATED_DECLSPEC) + set(COMPILER_HAS_DEPRECATED ${COMPILER_HAS_DEPRECATED_DECLSPEC}) else() - # TODO: Test properly for this - if(COMPILER_HAS_HIDDEN_VISIBILITY AND USE_COMPILER_HIDDEN_VISIBILITY) - set(COMPILER_HAS_DEPRECATED TRUE) - endif() + _check_cxx_compiler_attribute("__attribute__((__deprecated__))" COMPILER_HAS_DEPRECATED) endif() set(COMPILER_HAS_DEPRECATED "${COMPILER_HAS_DEPRECATED}" CACHE INTERNAL "Compiler support for a deprecated attribute") endmacro() @@ -162,14 +172,10 @@ macro(_DO_SET_MACRO_VALUES TARGET_LIBRARY) set(DEFINE_IMPORT) set(DEFINE_NO_EXPORT) - if(WIN32) - if (COMPILER_HAS_DEPRECATED) - set(DEFINE_DEPRECATED "__declspec(deprecated)") - endif() - else() - if(COMPILER_HAS_DEPRECATED) - set(DEFINE_DEPRECATED "__attribute__ ((__deprecated__))") - endif() + if (COMPILER_HAS_DEPRECATED_DECLSPEC) + set(DEFINE_DEPRECATED "__declspec(deprecated)") + elseif(COMPILER_HAS_DEPRECATED) + set(DEFINE_DEPRECATED "__attribute__ ((__deprecated__))") endif() get_property(type TARGET ${TARGET_LIBRARY} PROPERTY TYPE) diff --git a/Tests/Module/GenerateExportHeader/CMakeLists.txt b/Tests/Module/GenerateExportHeader/CMakeLists.txt index eb19afb..05d1519 100644 --- a/Tests/Module/GenerateExportHeader/CMakeLists.txt +++ b/Tests/Module/GenerateExportHeader/CMakeLists.txt @@ -49,7 +49,7 @@ macro(_do_build Include Library LibrarySource Source) "if(CMAKE_COMPILER_IS_GNUCXX OR (${CMAKE_CXX_COMPILER_ID} MATCHES Clang))\n" " add_definitions(-Werror)\n" "else()\n" - " if(MSVC)\n" + " if(MSVC AND COMPILER_HAS_DEPRECATED)\n" # Treat deprecation warnings as errors. " add_definitions(/we4996)\n" " endif()\n" @@ -123,7 +123,7 @@ if (CMAKE_COMPILER_IS_GNUCXX OR (${CMAKE_CXX_COMPILER_ID} MATCHES Clang)) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations") endif() -if(MSVC) +if(MSVC AND COMPILER_HAS_DEPRECATED) add_definitions(/wd4996) endif() http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9554e1013ef5d9971092ed0cd45daf59b8a6bd87 commit 9554e1013ef5d9971092ed0cd45daf59b8a6bd87 Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Thu Aug 11 18:17:12 2011 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Thu Aug 11 18:17:12 2011 +0200 Split the deprecated available check from setting macro values. diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake index 92b9433..f690655 100644 --- a/Modules/GenerateExportHeader.cmake +++ b/Modules/GenerateExportHeader.cmake @@ -140,6 +140,20 @@ macro(_test_compiler_hidden_visibility) endif() endmacro() +macro(_test_compiler_has_deprecated) + if (WIN32) + if (NOT ${CMAKE_CXX_COMPILER_ID} MATCHES Borland) + set(COMPILER_HAS_DEPRECATED TRUE) + endif() + else() + # TODO: Test properly for this + if(COMPILER_HAS_HIDDEN_VISIBILITY AND USE_COMPILER_HIDDEN_VISIBILITY) + set(COMPILER_HAS_DEPRECATED TRUE) + endif() + endif() + set(COMPILER_HAS_DEPRECATED "${COMPILER_HAS_DEPRECATED}" CACHE INTERNAL "Compiler support for a deprecated attribute") +endmacro() + set(myDir ${CMAKE_CURRENT_LIST_DIR}) macro(_DO_SET_MACRO_VALUES TARGET_LIBRARY) @@ -149,13 +163,11 @@ macro(_DO_SET_MACRO_VALUES TARGET_LIBRARY) set(DEFINE_NO_EXPORT) if(WIN32) - message("Compiler is ${CMAKE_CXX_COMPILER_ID}") - if (NOT ${CMAKE_CXX_COMPILER_ID} MATCHES Borland) - message("Deprecation macro enabled.") + if (COMPILER_HAS_DEPRECATED) set(DEFINE_DEPRECATED "__declspec(deprecated)") endif() else() - if(COMPILER_HAS_HIDDEN_VISIBILITY AND USE_COMPILER_HIDDEN_VISIBILITY) + if(COMPILER_HAS_DEPRECATED) set(DEFINE_DEPRECATED "__attribute__ ((__deprecated__))") endif() endif() @@ -244,6 +256,7 @@ function(GENERATE_EXPORT_HEADER TARGET_LIBRARY) return() endif() _test_compiler_hidden_visibility() + _test_compiler_has_deprecated() _do_set_macro_values(${TARGET_LIBRARY}) _do_generate_export_header(${TARGET_LIBRARY} ${ARGN}) endfunction() @@ -251,6 +264,7 @@ endfunction() function(add_compiler_export_flags) _test_compiler_hidden_visibility() + _test_compiler_has_deprecated() if(NOT (USE_COMPILER_HIDDEN_VISIBILITY AND COMPILER_HAS_HIDDEN_VISIBILITY)) message(WARNING "Compiler doesn't have hidden visibility") diff --git a/Tests/Module/GenerateExportHeader/lib_shared_and_statictest/CMakeLists.txt b/Tests/Module/GenerateExportHeader/lib_shared_and_statictest/CMakeLists.txt index d25eed0..1401eec 100644 --- a/Tests/Module/GenerateExportHeader/lib_shared_and_statictest/CMakeLists.txt +++ b/Tests/Module/GenerateExportHeader/lib_shared_and_statictest/CMakeLists.txt @@ -17,7 +17,7 @@ endmacro() static_variant_build_pass("return libshared_and_static_exported();" "Failed to build static variant") shared_variant_build_pass("return libshared_and_static_exported();" "Failed to build shared variant") -if (NOT ${CMAKE_CXX_COMPILER_ID} MATCHES Borland) +if (COMPILER_HAS_DEPRECATED) shared_variant_build_fail("return libshared_and_static_deprecated();" "Built shared deprecated variant") static_variant_build_fail("return libshared_and_static_deprecated();" "Built static deprecated variant") else() diff --git a/Tests/Module/GenerateExportHeader/libsharedtest/CMakeLists.txt b/Tests/Module/GenerateExportHeader/libsharedtest/CMakeLists.txt index 9edc53f..b763036 100644 --- a/Tests/Module/GenerateExportHeader/libsharedtest/CMakeLists.txt +++ b/Tests/Module/GenerateExportHeader/libsharedtest/CMakeLists.txt @@ -9,7 +9,7 @@ endmacro() shared_build_pass("Libshared l; return l.libshared_exported();" "Failed to build exported") -if (NOT ${CMAKE_CXX_COMPILER_ID} MATCHES Borland) +if (COMPILER_HAS_DEPRECATED) shared_build_fail("Libshared l; return l.libshared_deprecated();" "Built use of deprecated class method. This should not be possible.") else() shared_build_pass("Libshared l; return l.libshared_deprecated();" "Built use of deprecated class method. This should not be possible.") diff --git a/Tests/Module/GenerateExportHeader/libstatictest/CMakeLists.txt b/Tests/Module/GenerateExportHeader/libstatictest/CMakeLists.txt index 168cae8..14ca05b 100644 --- a/Tests/Module/GenerateExportHeader/libstatictest/CMakeLists.txt +++ b/Tests/Module/GenerateExportHeader/libstatictest/CMakeLists.txt @@ -9,7 +9,7 @@ endmacro() static_build_pass("Libstatic l; return l.libstatic_exported();" "Failed to build exported.") -if (NOT ${CMAKE_CXX_COMPILER_ID} MATCHES Borland) +if (COMPILER_HAS_DEPRECATED) static_build_fail("Libstatic l; return l.libstatic_deprecated();" "Built use of deprecated class method. This should not be possible.") static_build_fail("libstatic_deprecated();" "Built use of deprecated function. This should not be possible.") else() ----------------------------------------------------------------------- Summary of changes: Modules/GenerateExportHeader.cmake | 40 +++++++++++++++----- Tests/Module/GenerateExportHeader/CMakeLists.txt | 4 +- .../lib_shared_and_statictest/CMakeLists.txt | 2 +- .../libsharedtest/CMakeLists.txt | 2 +- .../libstatictest/CMakeLists.txt | 2 +- 5 files changed, 35 insertions(+), 15 deletions(-) hooks/post-receive -- CMake _______________________________________________ Cmake-commits mailing list Cmake-commits@cmake.org http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-commits