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, master has been updated via 6a6900f61666977948bffa1409d4633799de323c (commit) via 71e74b4ae453473d597ce5a53e2e8e7641dc832a (commit) via fe9a16c80fe921d2db66c0699b4197f85a281e7e (commit) via dda4755b467db297b04cc1678e0d7c6035ad4c2f (commit) via a23ac516b3ccdba9efb22f19edcb7cd676a510b4 (commit) via 4a5e003d4c69c054a7e0123d9ec3adb5bdbd6e39 (commit) via 287bf93a114cae7461e8bf8da021b135ce561a1a (commit) via bab24e782c1bf56ef7263e91e5cf78879699a036 (commit) via c86e82c09299211c76366640dd0f21a6d5acc9e8 (commit) via e0d6d01e522d4207eecc927cffabbb9a8d1b757d (commit) via 83dab0c123c0831c736fed5de3c24c2168e40541 (commit) from abccf484e3c13395520fea544885e139fc79475e (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6a6900f61666977948bffa1409d4633799de323c commit 6a6900f61666977948bffa1409d4633799de323c Merge: 71e74b4 bab24e7 Author: Brad King <brad.k...@kitware.com> AuthorDate: Wed Dec 12 13:32:11 2018 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Wed Dec 12 08:32:17 2018 -0500 Merge topic 'object-library-link' bab24e782c target_link_libraries: Propagate dependencies of object libraries Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !2725 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=71e74b4ae453473d597ce5a53e2e8e7641dc832a commit 71e74b4ae453473d597ce5a53e2e8e7641dc832a Merge: a23ac51 fe9a16c Author: Brad King <brad.k...@kitware.com> AuthorDate: Wed Dec 12 13:30:35 2018 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Wed Dec 12 08:30:45 2018 -0500 Merge topic 'fix-configure-line-number' fe9a16c80f cmMakefile: Fix @CMAKE_CURRENT_LIST_LINE@ for ExpandVariablesInStringNew dda4755b46 cmMakefile: Fix ConfigureString not passing filename and line Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !2675 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fe9a16c80fe921d2db66c0699b4197f85a281e7e commit fe9a16c80fe921d2db66c0699b4197f85a281e7e Author: Artur Ryt <artur....@gmail.com> AuthorDate: Fri Nov 30 23:51:05 2018 +0100 Commit: Brad King <brad.k...@kitware.com> CommitDate: Wed Dec 12 08:29:14 2018 -0500 cmMakefile: Fix @CMAKE_CURRENT_LIST_LINE@ for ExpandVariablesInStringNew Added check for variable name in @@ evaluation and test for configuring @CMAKE_CURRENT_LIST_LINE@ with new CMP0053 Fixes: #18646 diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 9ed0dc3..5cd6ba5 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2727,6 +2727,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew( cmState* state = this->GetCMakeInstance()->GetState(); + static const std::string lineVar = "CMAKE_CURRENT_LIST_LINE"; do { char inc = *in; switch (inc) { @@ -2739,7 +2740,6 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew( const char* value = nullptr; std::string varresult; std::string svalue; - static const std::string lineVar = "CMAKE_CURRENT_LIST_LINE"; switch (var.domain) { case NORMAL: if (filename && lookup == lineVar) { @@ -2889,7 +2889,14 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew( "abcdefghijklmnopqrstuvwxyz" "0123456789/_.+-")) { std::string variable(in + 1, nextAt - in - 1); - std::string varresult = this->GetSafeDefinition(variable); + + std::string varresult; + if (filename && variable == lineVar) { + varresult = std::to_string(line); + } else { + varresult = this->GetSafeDefinition(variable); + } + if (escapeQuotes) { varresult = cmSystemTools::EscapeQuotes(varresult); } diff --git a/Tests/CMakeTests/StringTest.cmake.in b/Tests/CMakeTests/StringTest.cmake.in index 3e9327b..154afa7 100644 --- a/Tests/CMakeTests/StringTest.cmake.in +++ b/Tests/CMakeTests/StringTest.cmake.in @@ -81,7 +81,7 @@ check_cmake_test(String # Execute each test listed in StringTestScript.cmake: # set(scriptname "@CMAKE_CURRENT_SOURCE_DIR@/StringTestScript.cmake") -set(number_of_tests_expected 73) +set(number_of_tests_expected 74) include("@CMAKE_CURRENT_SOURCE_DIR@/ExecuteScriptTests.cmake") execute_all_script_tests(${scriptname} number_of_tests_executed) diff --git a/Tests/CMakeTests/StringTestScript.cmake b/Tests/CMakeTests/StringTestScript.cmake index d8f31dd..e069897 100644 --- a/Tests/CMakeTests/StringTestScript.cmake +++ b/Tests/CMakeTests/StringTestScript.cmake @@ -54,6 +54,9 @@ elseif(testname STREQUAL configure_line_number_CMP0053_new) # pass elseif(testname STREQUAL configure_line_number_CMP0053_old_use_at) # pass test_configure_line_number("\@CMAKE_CURRENT_LIST_LINE\@" OLD) +elseif(testname STREQUAL configure_line_number_CMP0053_new_use_at) # pass + test_configure_line_number("\@CMAKE_CURRENT_LIST_LINE\@" NEW) + elseif(testname STREQUAL configure_bogus) # fail string(CONFIGURE "this is @testname@" v ESCAPE_QUOTES BOGUS) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dda4755b467db297b04cc1678e0d7c6035ad4c2f commit dda4755b467db297b04cc1678e0d7c6035ad4c2f Author: Artur Ryt <artur....@gmail.com> AuthorDate: Fri Nov 30 23:50:37 2018 +0100 Commit: Brad King <brad.k...@kitware.com> CommitDate: Wed Dec 12 08:29:01 2018 -0500 cmMakefile: Fix ConfigureString not passing filename and line It enables to use CMAKE_CURRENT_LIST_LINE in string(CONFIGURE) Added tests for it for ${} and @@ notattion for old CMP0053 and ${} for new diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 5ad8ef6..9ed0dc3 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3648,8 +3648,15 @@ void cmMakefile::ConfigureString(const std::string& input, std::string& output, } // Perform variable replacements. - this->ExpandVariablesInString(output, escapeQuotes, true, atOnly, nullptr, - -1, true, true); + const char* filename = nullptr; + long lineNumber = -1; + if (!this->Backtrace.Empty()) { + const auto& currentTrace = this->Backtrace.Top(); + filename = currentTrace.FilePath.c_str(); + lineNumber = currentTrace.Line; + } + this->ExpandVariablesInString(output, escapeQuotes, true, atOnly, filename, + lineNumber, true, true); } int cmMakefile::ConfigureFile(const char* infile, const char* outfile, diff --git a/Tests/CMakeTests/StringTest.cmake.in b/Tests/CMakeTests/StringTest.cmake.in index 566f4b1..3e9327b 100644 --- a/Tests/CMakeTests/StringTest.cmake.in +++ b/Tests/CMakeTests/StringTest.cmake.in @@ -81,7 +81,7 @@ check_cmake_test(String # Execute each test listed in StringTestScript.cmake: # set(scriptname "@CMAKE_CURRENT_SOURCE_DIR@/StringTestScript.cmake") -set(number_of_tests_expected 70) +set(number_of_tests_expected 73) include("@CMAKE_CURRENT_SOURCE_DIR@/ExecuteScriptTests.cmake") execute_all_script_tests(${scriptname} number_of_tests_executed) diff --git a/Tests/CMakeTests/StringTestScript.cmake b/Tests/CMakeTests/StringTestScript.cmake index 44d5653..d8f31dd 100644 --- a/Tests/CMakeTests/StringTestScript.cmake +++ b/Tests/CMakeTests/StringTestScript.cmake @@ -1,5 +1,18 @@ message(STATUS "testname='${testname}'") +function(test_configure_line_number EXPRESSION POLICY) + cmake_policy(PUSH) + cmake_policy(SET CMP0053 ${POLICY}) + string(CONFIGURE + "${EXPRESSION}" v) # line should indicate string() call + math(EXPR vplus3 "${v} + 3") + if(NOT ${CMAKE_CURRENT_LIST_LINE} EQUAL ${vplus3}) + message(SEND_ERROR "Couldn't configure CMAKE_CURRENT_LIST_LINE, evaluated into '${v}'") + endif() + message(STATUS "v='${v}'") + cmake_policy(POP) +endfunction() + if(testname STREQUAL empty) # fail string() @@ -32,6 +45,15 @@ elseif(testname STREQUAL configure_escape_quotes) # pass string(CONFIGURE "this is @testname@" v ESCAPE_QUOTES) message(STATUS "v='${v}'") +elseif(testname STREQUAL configure_line_number_CMP0053_old) # pass + test_configure_line_number("\${CMAKE_CURRENT_LIST_LINE}" OLD) + +elseif(testname STREQUAL configure_line_number_CMP0053_new) # pass + test_configure_line_number("\${CMAKE_CURRENT_LIST_LINE}" NEW) + +elseif(testname STREQUAL configure_line_number_CMP0053_old_use_at) # pass + test_configure_line_number("\@CMAKE_CURRENT_LIST_LINE\@" OLD) + elseif(testname STREQUAL configure_bogus) # fail string(CONFIGURE "this is @testname@" v ESCAPE_QUOTES BOGUS) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a23ac516b3ccdba9efb22f19edcb7cd676a510b4 commit a23ac516b3ccdba9efb22f19edcb7cd676a510b4 Merge: 4a5e003 c86e82c Author: Brad King <brad.k...@kitware.com> AuthorDate: Wed Dec 12 13:24:10 2018 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Wed Dec 12 08:25:04 2018 -0500 Merge topic 'machoFormat' c86e82c092 Add Mach-O CMAKE_EXECUTABLE_FORMAT detection Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !2722 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4a5e003d4c69c054a7e0123d9ec3adb5bdbd6e39 commit 4a5e003d4c69c054a7e0123d9ec3adb5bdbd6e39 Merge: 287bf93 83dab0c Author: Brad King <brad.k...@kitware.com> AuthorDate: Wed Dec 12 13:23:46 2018 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Wed Dec 12 08:24:10 2018 -0500 Merge topic 'FindThreads-drop-irix' 83dab0c123 FindThreads: Drop IRIX-specific options and results Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !2717 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=287bf93a114cae7461e8bf8da021b135ce561a1a commit 287bf93a114cae7461e8bf8da021b135ce561a1a Merge: abccf48 e0d6d01 Author: Brad King <brad.k...@kitware.com> AuthorDate: Wed Dec 12 13:23:20 2018 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Wed Dec 12 08:23:26 2018 -0500 Merge topic 'vs_conformance_mode_flags' e0d6d01e52 VS: Add flag table entry for "permissive" flag to disable conformance mode Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !2723 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bab24e782c1bf56ef7263e91e5cf78879699a036 commit bab24e782c1bf56ef7263e91e5cf78879699a036 Author: Kyle Edwards <kyle.edwa...@kitware.com> AuthorDate: Mon Dec 10 10:39:22 2018 -0500 Commit: Kyle Edwards <kyle.edwa...@kitware.com> CommitDate: Mon Dec 10 14:57:28 2018 -0500 target_link_libraries: Propagate dependencies of object libraries Prior to this commit, linking against an object library did not propagate private link dependencies of object libraries to their consuming targets. This change implements the correct behavior. Fixes: #18692 Co-Author: Brad King <brad.k...@kitware.com> diff --git a/Help/release/dev/object-library-link.rst b/Help/release/dev/object-library-link.rst new file mode 100644 index 0000000..990d915 --- /dev/null +++ b/Help/release/dev/object-library-link.rst @@ -0,0 +1,5 @@ +object-library-link +------------------- + +* Object library linking has been fixed to propagate transitive link + dependencies of object libraries to consuming targets. diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx index 66cc6ee..eebf7a0 100644 --- a/Source/cmTargetLinkLibrariesCommand.cxx +++ b/Source/cmTargetLinkLibrariesCommand.cxx @@ -451,7 +451,8 @@ bool cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib, // STATIC library.) if (this->CurrentProcessingState == ProcessingKeywordPrivateInterface || this->CurrentProcessingState == ProcessingPlainPrivateInterface) { - if (this->Target->GetType() == cmStateEnums::STATIC_LIBRARY) { + if (this->Target->GetType() == cmStateEnums::STATIC_LIBRARY || + this->Target->GetType() == cmStateEnums::OBJECT_LIBRARY) { std::string configLib = this->Target->GetDebugGeneratorExpressions(libRef, llt); if (cmGeneratorExpression::IsValidTargetName(libRef) || diff --git a/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake b/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake index c73732f..6ca33b8 100644 --- a/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake +++ b/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake @@ -45,6 +45,7 @@ run_object_lib_build2(LinkObjRHSObject) run_object_lib_build(LinkObjRHSShared2) run_object_lib_build(LinkObjRHSStatic2) run_object_lib_build2(LinkObjRHSObject2) +run_object_lib_build(TransitiveDependencies) run_cmake(MissingSource) run_cmake(ObjWithObj) diff --git a/Tests/RunCMake/ObjectLibrary/TransitiveDependencies.cmake b/Tests/RunCMake/ObjectLibrary/TransitiveDependencies.cmake new file mode 100644 index 0000000..e41cf2e --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/TransitiveDependencies.cmake @@ -0,0 +1,7 @@ +add_library(lib1 STATIC depends_obj0.c) +add_library(lib2 OBJECT a.c) +target_link_libraries(lib2 PRIVATE lib1) + +add_executable(test exe2.c) + +target_link_libraries(test PUBLIC lib2) diff --git a/Tests/RunCMake/ObjectLibrary/exe2.c b/Tests/RunCMake/ObjectLibrary/exe2.c new file mode 100644 index 0000000..66e0caf --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/exe2.c @@ -0,0 +1,6 @@ +extern int myobj_foo(void); + +int main(void) +{ + return myobj_foo(); +} https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c86e82c09299211c76366640dd0f21a6d5acc9e8 commit c86e82c09299211c76366640dd0f21a6d5acc9e8 Author: Maikel van den Hurk <maikel.vandenh...@tomtom.com> AuthorDate: Mon Dec 10 07:24:53 2018 +0100 Commit: Brad King <brad.k...@kitware.com> CommitDate: Mon Dec 10 14:41:42 2018 -0500 Add Mach-O CMAKE_EXECUTABLE_FORMAT detection Code for this was prototyped when ELF detection was added long ago but left commented out. Use either MH_MAGIC or MH_CIGAM for the 32-bit variant and use either or MH_MAGIC_64 or MH_CIGAM_64 for the 64-bit variant. diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 5e2df26..050d3e7 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -659,13 +659,10 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file) # set(CMAKE_EXECUTABLE_FORMAT "COFF" CACHE STRING "Executable file format") # endif() # -# # Mach-O files start with CAFEBABE or FEEDFACE, according to http://radio.weblogs.com/0100490/2003/01/28.html -# if("${CMAKE_EXECUTABLE_MAGIC}" MATCHES "cafebabe") -# set(CMAKE_EXECUTABLE_FORMAT "MACHO" CACHE STRING "Executable file format") -# endif() -# if("${CMAKE_EXECUTABLE_MAGIC}" MATCHES "feedface") -# set(CMAKE_EXECUTABLE_FORMAT "MACHO" CACHE STRING "Executable file format") -# endif() + # Mach-O files start with MH_MAGIC or MH_CIGAM + if("${CMAKE_EXECUTABLE_MAGIC}" MATCHES "feedface|cefaedfe|feedfacf|cffaedfe") + set(CMAKE_EXECUTABLE_FORMAT "MACHO" CACHE STRING "Executable file format") + endif() endif() if(NOT DEFINED CMAKE_EXECUTABLE_FORMAT) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e0d6d01e522d4207eecc927cffabbb9a8d1b757d commit e0d6d01e522d4207eecc927cffabbb9a8d1b757d Author: Jonathan Storey <jonathan.sto...@nanoporetech.com> AuthorDate: Mon Dec 10 11:59:22 2018 +0000 Commit: Jonathan Storey <jonathan.sto...@nanoporetech.com> CommitDate: Mon Dec 10 16:59:19 2018 +0000 VS: Add flag table entry for "permissive" flag to disable conformance mode This flag is required to disable conformance mode on specific sources when it is otherwise enabled on most sources. diff --git a/Templates/MSBuild/FlagTables/v141_CL.json b/Templates/MSBuild/FlagTables/v141_CL.json index d566526..01fafe4 100644 --- a/Templates/MSBuild/FlagTables/v141_CL.json +++ b/Templates/MSBuild/FlagTables/v141_CL.json @@ -812,11 +812,18 @@ { "name": "ConformanceMode", "switch": "permissive-", - "comment": "Conformance mode", + "comment": "Conformance mode enabled", "value": "true", "flags": [] }, { + "name": "ConformanceMode", + "switch": "permissive", + "comment": "Conformance mode disabled", + "value": "false", + "flags": [] + }, + { "name": "TreatWChar_tAsBuiltInType", "switch": "Zc:wchar_t-", "comment": "Treat WChar_t As Built in Type", https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=83dab0c123c0831c736fed5de3c24c2168e40541 commit 83dab0c123c0831c736fed5de3c24c2168e40541 Author: Brad King <brad.k...@kitware.com> AuthorDate: Fri Dec 7 13:28:45 2018 -0500 Commit: Brad King <brad.k...@kitware.com> CommitDate: Fri Dec 7 13:33:01 2018 -0500 FindThreads: Drop IRIX-specific options and results We do not need to support IRIX anymore, so drop relevant parts. In particular, the `CMAKE_THREAD_PREFER_PTHREAD` is frequently confused with `THREADS_PREFER_PTHREAD_FLAG`. Also remove references to the IRIX-specific options and results from other modules and tests. diff --git a/Modules/CMakeBackwardCompatibilityC.cmake b/Modules/CMakeBackwardCompatibilityC.cmake index 5d86d73..775a513 100644 --- a/Modules/CMakeBackwardCompatibilityC.cmake +++ b/Modules/CMakeBackwardCompatibilityC.cmake @@ -59,9 +59,6 @@ if(NOT CMAKE_SKIP_COMPATIBILITY_TESTS) set (CMAKE_HP_PTHREADS ${CMAKE_HP_PTHREADS_INIT} CACHE BOOL "Use HP pthreads.") - set (CMAKE_USE_SPROC ${CMAKE_USE_SPROC_INIT} CACHE BOOL - "Use sproc libs.") - if(__ERASE_CMAKE_TRY_COMPILE_OSX_ARCHITECTURES) set(CMAKE_TRY_COMPILE_OSX_ARCHITECTURES) set(__ERASE_CMAKE_TRY_COMPILE_OSX_ARCHITECTURES) @@ -72,7 +69,6 @@ mark_as_advanced( CMAKE_HP_PTHREADS CMAKE_THREAD_LIBS CMAKE_USE_PTHREADS -CMAKE_USE_SPROC CMAKE_USE_WIN32_THREADS CMAKE_X_CFLAGS CMAKE_X_LIBS diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index 0f5cab4..228eed4 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -875,11 +875,7 @@ endif() if(CUDA_USE_STATIC_CUDA_RUNTIME) if(UNIX) - # Check for the dependent libraries. Here we look for pthreads. - if (DEFINED CMAKE_THREAD_PREFER_PTHREAD) - set(_cuda_cmake_thread_prefer_pthread ${CMAKE_THREAD_PREFER_PTHREAD}) - endif() - set(CMAKE_THREAD_PREFER_PTHREAD 1) + # Check for the dependent libraries. # Many of the FindXYZ CMake comes with makes use of try_compile with int main(){return 0;} # as the source file. Unfortunately this causes a warning with -Wstrict-prototypes and @@ -890,13 +886,6 @@ if(CUDA_USE_STATIC_CUDA_RUNTIME) find_package(Threads REQUIRED) set(CMAKE_C_FLAGS ${_cuda_cmake_c_flags}) - if (DEFINED _cuda_cmake_thread_prefer_pthread) - set(CMAKE_THREAD_PREFER_PTHREAD ${_cuda_cmake_thread_prefer_pthread}) - unset(_cuda_cmake_thread_prefer_pthread) - else() - unset(CMAKE_THREAD_PREFER_PTHREAD) - endif() - if(NOT APPLE) #On Linux, you must link against librt when using the static cuda runtime. find_library(CUDA_rt_LIBRARY rt) diff --git a/Modules/FindDCMTK.cmake b/Modules/FindDCMTK.cmake index 302c089..111e0ff 100644 --- a/Modules/FindDCMTK.cmake +++ b/Modules/FindDCMTK.cmake @@ -200,7 +200,6 @@ if(DCMTK_oflog_LIBRARY_RELEASE OR DCMTK_oflog_LIBRARY_DEBUG) # Hack - Not having a DCMTKConfig.cmake file to read the settings from, we will attempt to # find the library in all cases. # Ideally, pthread library should be discovered only if DCMTK_WITH_THREADS is enabled. - set(CMAKE_THREAD_PREFER_PTHREAD TRUE) find_package(Threads) endif() diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake index 691b1b7..9c96a1b 100644 --- a/Modules/FindThreads.cmake +++ b/Modules/FindThreads.cmake @@ -12,7 +12,6 @@ The following variables are set :: CMAKE_THREAD_LIBS_INIT - the thread library - CMAKE_USE_SPROC_INIT - are we using sproc? CMAKE_USE_WIN32_THREADS_INIT - using WIN32 threads? CMAKE_USE_PTHREADS_INIT - are we using pthreads CMAKE_HP_PTHREADS_INIT - are we using hp pthreads @@ -23,12 +22,6 @@ The following import target is created Threads::Threads -For systems with multiple thread libraries, caller can set - -:: - - CMAKE_THREAD_PREFER_PTHREAD - If the use of the -pthread compiler and linker flag is preferred then the caller can set @@ -55,12 +48,6 @@ else() message(FATAL_ERROR "FindThreads only works if either C or CXX language is enabled") endif() -# Do we have sproc? -if(CMAKE_SYSTEM_NAME MATCHES IRIX AND NOT CMAKE_THREAD_PREFER_PTHREAD) - include (CheckIncludeFiles) - CHECK_INCLUDE_FILES("sys/types.h;sys/prctl.h" CMAKE_HAVE_SPROC_H) -endif() - # Internal helper macro. # Do NOT even think about using it outside of this file! macro(_check_threads_lib LIBNAME FUNCNAME VARNAME) @@ -113,58 +100,53 @@ macro(_check_pthreads_flag) endif() endmacro() -if(CMAKE_HAVE_SPROC_H AND NOT CMAKE_THREAD_PREFER_PTHREAD) - # We have sproc - set(CMAKE_USE_SPROC_INIT 1) +# Do we have pthreads? +if(CMAKE_C_COMPILER_LOADED) + CHECK_INCLUDE_FILE("pthread.h" CMAKE_HAVE_PTHREAD_H) else() - # Do we have pthreads? - if(CMAKE_C_COMPILER_LOADED) - CHECK_INCLUDE_FILE("pthread.h" CMAKE_HAVE_PTHREAD_H) - else() - CHECK_INCLUDE_FILE_CXX("pthread.h" CMAKE_HAVE_PTHREAD_H) - endif() - if(CMAKE_HAVE_PTHREAD_H) - - # - # We have pthread.h - # Let's check for the library now. - # - set(CMAKE_HAVE_THREADS_LIBRARY) - if(NOT THREADS_HAVE_PTHREAD_ARG) - # Check if pthread functions are in normal C library. - # If the pthread functions already exist in C library, we could just use - # them instead of linking to the additional pthread library. We could - # try to check any pthread symbol name, but here is an exception. If we - # use clang asan build, we will find the pthread_create() symbol in the - # libc(libasan). However, it doesn't have the full pthread implementation. - # So, we can't assume that we have the pthread implementation in libc - # using the pthread_create() checking here. Then, we turn to check the - # pthread_kill() symbol instead. - CHECK_SYMBOL_EXISTS(pthread_kill pthread.h CMAKE_HAVE_LIBC_PTHREAD_KILL) - if(CMAKE_HAVE_LIBC_PTHREAD_KILL) - set(CMAKE_THREAD_LIBS_INIT "") - set(CMAKE_HAVE_THREADS_LIBRARY 1) - set(Threads_FOUND TRUE) - else() - - # Check for -pthread first if enabled. This is the recommended - # way, but not backwards compatible as one must also pass -pthread - # as compiler flag then. - if (THREADS_PREFER_PTHREAD_FLAG) - _check_pthreads_flag() - endif () - - _check_threads_lib(pthreads pthread_create CMAKE_HAVE_PTHREADS_CREATE) - _check_threads_lib(pthread pthread_create CMAKE_HAVE_PTHREAD_CREATE) - if(CMAKE_SYSTEM_NAME MATCHES "SunOS") - # On sun also check for -lthread - _check_threads_lib(thread thr_create CMAKE_HAVE_THR_CREATE) - endif() + CHECK_INCLUDE_FILE_CXX("pthread.h" CMAKE_HAVE_PTHREAD_H) +endif() +if(CMAKE_HAVE_PTHREAD_H) + + # + # We have pthread.h + # Let's check for the library now. + # + set(CMAKE_HAVE_THREADS_LIBRARY) + if(NOT THREADS_HAVE_PTHREAD_ARG) + # Check if pthread functions are in normal C library. + # If the pthread functions already exist in C library, we could just use + # them instead of linking to the additional pthread library. We could + # try to check any pthread symbol name, but here is an exception. If we + # use clang asan build, we will find the pthread_create() symbol in the + # libc(libasan). However, it doesn't have the full pthread implementation. + # So, we can't assume that we have the pthread implementation in libc + # using the pthread_create() checking here. Then, we turn to check the + # pthread_kill() symbol instead. + CHECK_SYMBOL_EXISTS(pthread_kill pthread.h CMAKE_HAVE_LIBC_PTHREAD_KILL) + if(CMAKE_HAVE_LIBC_PTHREAD_KILL) + set(CMAKE_THREAD_LIBS_INIT "") + set(CMAKE_HAVE_THREADS_LIBRARY 1) + set(Threads_FOUND TRUE) + else() + + # Check for -pthread first if enabled. This is the recommended + # way, but not backwards compatible as one must also pass -pthread + # as compiler flag then. + if (THREADS_PREFER_PTHREAD_FLAG) + _check_pthreads_flag() + endif () + + _check_threads_lib(pthreads pthread_create CMAKE_HAVE_PTHREADS_CREATE) + _check_threads_lib(pthread pthread_create CMAKE_HAVE_PTHREAD_CREATE) + if(CMAKE_SYSTEM_NAME MATCHES "SunOS") + # On sun also check for -lthread + _check_threads_lib(thread thr_create CMAKE_HAVE_THR_CREATE) endif() endif() - - _check_pthreads_flag() endif() + + _check_pthreads_flag() endif() if(CMAKE_THREAD_LIBS_INIT OR CMAKE_HAVE_LIBC_PTHREAD_KILL) diff --git a/Modules/Qt4ConfigDependentSettings.cmake b/Modules/Qt4ConfigDependentSettings.cmake index 684ec21..4699ecd 100644 --- a/Modules/Qt4ConfigDependentSettings.cmake +++ b/Modules/Qt4ConfigDependentSettings.cmake @@ -256,7 +256,6 @@ if(Q_WS_X11) # X11 libraries Qt always depends on set(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${X11_Xext_LIB} ${X11_X11_LIB}) - set(CMAKE_THREAD_PREFER_PTHREAD 1) find_package(Threads) if(CMAKE_USE_PTHREADS_INIT) set(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${CMAKE_THREAD_LIBS_INIT}) diff --git a/Tests/FindThreads/C-only/CMakeLists.txt b/Tests/FindThreads/C-only/CMakeLists.txt index ab4ca0d..ee2a5f9 100644 --- a/Tests/FindThreads/C-only/CMakeLists.txt +++ b/Tests/FindThreads/C-only/CMakeLists.txt @@ -1,7 +1,6 @@ cmake_minimum_required(VERSION 3.3 FATAL_ERROR) project(FindThreads_C-only C) -set(CMAKE_THREAD_PREFER_PTHREAD On) find_package(Threads REQUIRED) if (NOT WIN32) diff --git a/Tests/FindThreads/CXX-only/CMakeLists.txt b/Tests/FindThreads/CXX-only/CMakeLists.txt index 9993123..3c6cc1e 100644 --- a/Tests/FindThreads/CXX-only/CMakeLists.txt +++ b/Tests/FindThreads/CXX-only/CMakeLists.txt @@ -1,7 +1,6 @@ cmake_minimum_required(VERSION 3.3 FATAL_ERROR) project(FindThreads_CXX-only CXX) -set(CMAKE_THREAD_PREFER_PTHREAD On) find_package(Threads REQUIRED) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../../../Modules/CheckForPthreads.c ----------------------------------------------------------------------- Summary of changes: Help/release/dev/object-library-link.rst | 5 + Modules/CMakeBackwardCompatibilityC.cmake | 4 - Modules/CMakeDetermineCompilerId.cmake | 11 +-- Modules/FindCUDA.cmake | 13 +-- Modules/FindDCMTK.cmake | 1 - Modules/FindThreads.cmake | 104 +++++++++------------ Modules/Qt4ConfigDependentSettings.cmake | 1 - Source/cmMakefile.cxx | 22 ++++- Source/cmTargetLinkLibrariesCommand.cxx | 3 +- Templates/MSBuild/FlagTables/v141_CL.json | 9 +- Tests/CMakeTests/StringTest.cmake.in | 2 +- Tests/CMakeTests/StringTestScript.cmake | 25 +++++ Tests/FindThreads/C-only/CMakeLists.txt | 1 - Tests/FindThreads/CXX-only/CMakeLists.txt | 1 - Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake | 1 + .../ObjectLibrary/TransitiveDependencies.cmake | 7 ++ Tests/RunCMake/ObjectLibrary/exe2.c | 6 ++ 17 files changed, 121 insertions(+), 95 deletions(-) create mode 100644 Help/release/dev/object-library-link.rst create mode 100644 Tests/RunCMake/ObjectLibrary/TransitiveDependencies.cmake create mode 100644 Tests/RunCMake/ObjectLibrary/exe2.c hooks/post-receive -- CMake _______________________________________________ Cmake-commits mailing list Cmake-commits@cmake.org https://cmake.org/mailman/listinfo/cmake-commits