diff options
-rw-r--r-- | Modules/Compiler/Clang.cmake | 4 | ||||
-rw-r--r-- | Modules/Compiler/GNU.cmake | 4 | ||||
-rw-r--r-- | Modules/FindThreads.cmake | 8 | ||||
-rw-r--r-- | Tests/CMakeLib/testCTestResourceSpec.cxx | 1 | ||||
-rw-r--r-- | Tests/CMakeLib/testCTestResourceSpec_data/spec36.json | 4 |
5 files changed, 15 insertions, 6 deletions
diff --git a/Modules/Compiler/Clang.cmake b/Modules/Compiler/Clang.cmake index ea5a3b3..5cc9328 100644 --- a/Modules/Compiler/Clang.cmake +++ b/Modules/Compiler/Clang.cmake @@ -98,7 +98,9 @@ else() ) set(CMAKE_PCH_EXTENSION .pch) - set(CMAKE_PCH_PROLOGUE "#pragma clang system_header") + if (NOT CMAKE_GENERATOR MATCHES "Xcode") + set(CMAKE_PCH_PROLOGUE "#pragma clang system_header") + endif() set(CMAKE_${lang}_COMPILE_OPTIONS_USE_PCH -Xclang -include-pch -Xclang <PCH_FILE>) set(CMAKE_${lang}_COMPILE_OPTIONS_CREATE_PCH -Xclang -emit-pch -Xclang -include -Xclang <PCH_HEADER>) endmacro() diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake index 6960571..1c050a2 100644 --- a/Modules/Compiler/GNU.cmake +++ b/Modules/Compiler/GNU.cmake @@ -111,7 +111,9 @@ macro(__compiler_gnu lang) list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "-dM" "-E" "-c" "${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp") set(CMAKE_PCH_EXTENSION .gch) - set(CMAKE_PCH_PROLOGUE "#pragma GCC system_header") + if (NOT CMAKE_GENERATOR MATCHES "Xcode") + set(CMAKE_PCH_PROLOGUE "#pragma GCC system_header") + endif() set(CMAKE_${lang}_COMPILE_OPTIONS_USE_PCH -Winvalid-pch -include <PCH_HEADER>) set(CMAKE_${lang}_COMPILE_OPTIONS_CREATE_PCH -Winvalid-pch -x ${__pch_header_${lang}} -include <PCH_HEADER>) endmacro() diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake index d39fe33..b0c91b2 100644 --- a/Modules/FindThreads.cmake +++ b/Modules/FindThreads.cmake @@ -77,7 +77,7 @@ macro(_check_threads_lib LIBNAME FUNCNAME VARNAME) if(NOT Threads_FOUND) CHECK_LIBRARY_EXISTS(${LIBNAME} ${FUNCNAME} "" ${VARNAME}) if(${VARNAME}) - set(CMAKE_THREAD_LIBS_INIT "${LIBNAME}") + set(CMAKE_THREAD_LIBS_INIT "-l${LIBNAME}") set(CMAKE_HAVE_THREADS_LIBRARY 1) set(Threads_FOUND TRUE) endif() @@ -88,7 +88,7 @@ endmacro() # Do NOT even think about using it outside of this file! macro(_check_pthreads_flag) if(NOT Threads_FOUND) - # If we did not find a thread library look for -pthread compiler option. + # If we did not found -lpthread, -lpthread, or -lthread, look for -pthread if(NOT DEFINED THREADS_HAVE_PTHREAD_ARG) message(STATUS "Check if compiler accepts -pthread") if(CMAKE_C_COMPILER_LOADED) @@ -164,7 +164,7 @@ if(CMAKE_HAVE_PTHREAD_H) _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 thread library with thr_create + # On sun also check for -lthread _check_threads_lib(thread thr_create CMAKE_HAVE_THR_CREATE) endif() endif() @@ -195,7 +195,7 @@ if(CMAKE_USE_PTHREADS_INIT) # are available. CHECK_LIBRARY_EXISTS(cma pthread_attr_create "" CMAKE_HAVE_HP_CMA) if(CMAKE_HAVE_HP_CMA) - set(CMAKE_THREAD_LIBS_INIT "cma") + set(CMAKE_THREAD_LIBS_INIT "-lcma") set(CMAKE_HP_PTHREADS_INIT 1) set(Threads_FOUND TRUE) endif() diff --git a/Tests/CMakeLib/testCTestResourceSpec.cxx b/Tests/CMakeLib/testCTestResourceSpec.cxx index b981387..b69003d 100644 --- a/Tests/CMakeLib/testCTestResourceSpec.cxx +++ b/Tests/CMakeLib/testCTestResourceSpec.cxx @@ -56,6 +56,7 @@ static const std::vector<ExpectedSpec> expectedResourceSpecs = { {"spec33.json", false, {{{}}}}, {"spec34.json", false, {{{}}}}, {"spec35.json", false, {{{}}}}, + {"spec36.json", false, {{{}}}}, {"noexist.json", false, {{{}}}}, /* clang-format on */ }; diff --git a/Tests/CMakeLib/testCTestResourceSpec_data/spec36.json b/Tests/CMakeLib/testCTestResourceSpec_data/spec36.json new file mode 100644 index 0000000..6175b1a --- /dev/null +++ b/Tests/CMakeLib/testCTestResourceSpec_data/spec36.json @@ -0,0 +1,4 @@ +{ + "local": [ + ] +} |