You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by sw...@apache.org on 2023/08/19 01:55:10 UTC
[logging-log4cxx] branch master updated: Use cmake recommended try_compile signatures (#262)
This is an automated email from the ASF dual-hosted git repository.
swebb2066 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git
The following commit(s) were added to refs/heads/master by this push:
new 7729526b Use cmake recommended try_compile signatures (#262)
7729526b is described below
commit 7729526b245e94eafe0de2c351558d22c3b6cce5
Author: Stephen Webb <st...@ieee.org>
AuthorDate: Sat Aug 19 11:55:04 2023 +1000
Use cmake recommended try_compile signatures (#262)
---
src/cmake/FindODBC.cmake | 4 ++--
src/cmake/boost-fallback/boost-fallback.cmake | 15 +++++++++------
.../compiler-features/check-compiler-support.cmake | 18 +++++++++---------
src/cmake/pthread/log4cxx-pthread.cmake | 14 ++++++++------
4 files changed, 28 insertions(+), 23 deletions(-)
diff --git a/src/cmake/FindODBC.cmake b/src/cmake/FindODBC.cmake
index 95bb5952..2e06c46c 100644
--- a/src/cmake/FindODBC.cmake
+++ b/src/cmake/FindODBC.cmake
@@ -7,8 +7,8 @@ include(FindPackageHandleStandardArgs)
# ODBC_FOUND, set to 'yes' if found
if(WIN32)
set(ODBC_LIBRARIES odbc32.lib user32.lib)
- try_compile(ODBC_FOUND "${CMAKE_BINARY_DIR}/find-odbc"
- "${CMAKE_CURRENT_LIST_DIR}/SQLAllocHandleTest.cpp"
+ try_compile(ODBC_FOUND
+ SOURCES "${CMAKE_CURRENT_LIST_DIR}/SQLAllocHandleTest.cpp"
LINK_LIBRARIES ${ODBC_LIBRARIES})
else()
option(ODBC_STATIC "Link to the odbc static library" OFF)
diff --git a/src/cmake/boost-fallback/boost-fallback.cmake b/src/cmake/boost-fallback/boost-fallback.cmake
index 93952a92..fc4dfa20 100644
--- a/src/cmake/boost-fallback/boost-fallback.cmake
+++ b/src/cmake/boost-fallback/boost-fallback.cmake
@@ -6,10 +6,12 @@
include(FindThreads)
-try_compile(STD_FILESYSTEM_FOUND "${CMAKE_BINARY_DIR}/boost-fallback-compile-tests"
- "${CMAKE_CURRENT_LIST_DIR}/test-stdfilesystem.cpp")
-try_compile(STD_EXPERIMENTAL_FILESYSTEM_FOUND "${CMAKE_BINARY_DIR}/boost-fallback-compile-tests"
- "${CMAKE_CURRENT_LIST_DIR}/test-stdexpfilesystem.cpp")
+try_compile(STD_FILESYSTEM_FOUND
+ SOURCES "${CMAKE_CURRENT_LIST_DIR}/test-stdfilesystem.cpp"
+)
+try_compile(STD_EXPERIMENTAL_FILESYSTEM_FOUND
+ SOURCES "${CMAKE_CURRENT_LIST_DIR}/test-stdexpfilesystem.cpp"
+)
# Check for standard headers that we need, fall back to boost if they're not found
set(NAMESPACE_ALIAS log4cxx)
@@ -18,8 +20,9 @@ option(PREFER_BOOST "Prefer Boost over std:: equivalents" OFF)
if( ${PREFER_BOOST} OR NOT ( ${STD_FILESYSTEM_FOUND} OR ${STD_EXPERIMENTAL_FILESYSTEM_FOUND} ) )
find_package(Boost COMPONENTS filesystem)
if( ${Boost_FOUND} )
- try_compile(Boost_FILESYSTEM_FOUND "${CMAKE_BINARY_DIR}/boost-fallback-compile-tests"
- "${CMAKE_CURRENT_LIST_DIR}/test-boostfilesystem.cpp")
+ try_compile(Boost_FILESYSTEM_FOUND
+ SOURCES "${CMAKE_CURRENT_LIST_DIR}/test-boostfilesystem.cpp"
+ )
endif( ${Boost_FOUND} )
endif()
diff --git a/src/cmake/compiler-features/check-compiler-support.cmake b/src/cmake/compiler-features/check-compiler-support.cmake
index 7f5f9a3a..6b6b4ea5 100644
--- a/src/cmake/compiler-features/check-compiler-support.cmake
+++ b/src/cmake/compiler-features/check-compiler-support.cmake
@@ -2,14 +2,14 @@
#
# Does the compiler support thread_local?
-try_compile(HAS_THREAD_LOCAL "${CMAKE_BINARY_DIR}/Testing/thread-local-test"
- "${CMAKE_CURRENT_LIST_DIR}/test-thread-local.cpp"
- CXX_STANDARD 11
- )
+try_compile(HAS_THREAD_LOCAL
+ SOURCES "${CMAKE_CURRENT_LIST_DIR}/test-thread-local.cpp"
+)
# Does the standard library support std::make_unique<T>>?
-try_compile(STD_MAKE_UNIQUE_FOUND "${CMAKE_BINARY_DIR}/boost-fallback-compile-tests"
- "${CMAKE_CURRENT_LIST_DIR}/test-make-unique.cpp")
+try_compile(STD_MAKE_UNIQUE_FOUND
+ SOURCES "${CMAKE_CURRENT_LIST_DIR}/test-make-unique.cpp"
+)
if( ${STD_MAKE_UNIQUE_FOUND} )
set(STD_MAKE_UNIQUE_IMPL "std::make_unique")
set(STD_MAKE_UNIQUE_FOUND 1)
@@ -20,7 +20,7 @@ endif()
# Does the standard library support std::basic_string<UniChar> and std::basic_ostream<UniChar>?
-try_compile(STD_LIB_HAS_UNICODE_STRING "${CMAKE_BINARY_DIR}/Testing/unicode-test"
- "${CMAKE_CURRENT_LIST_DIR}/test-unicode.cpp"
- )
+try_compile(STD_LIB_HAS_UNICODE_STRING
+ SOURCES "${CMAKE_CURRENT_LIST_DIR}/test-unicode.cpp"
+)
diff --git a/src/cmake/pthread/log4cxx-pthread.cmake b/src/cmake/pthread/log4cxx-pthread.cmake
index bd9e8590..331bba75 100644
--- a/src/cmake/pthread/log4cxx-pthread.cmake
+++ b/src/cmake/pthread/log4cxx-pthread.cmake
@@ -1,10 +1,12 @@
include(FindThreads)
-try_compile(PTHREAD_SETNAME_NP_FOUND "${CMAKE_BINARY_DIR}/pthread-compile-tests"
- "${CMAKE_CURRENT_LIST_DIR}/test-pthread-setname.cpp"
- LINK_LIBRARIES Threads::Threads )
+try_compile(PTHREAD_SETNAME_NP_FOUND
+ SOURCES "${CMAKE_CURRENT_LIST_DIR}/test-pthread-setname.cpp"
+ LINK_LIBRARIES Threads::Threads
+)
-try_compile(PTHREAD_GETNAME_NP_FOUND "${CMAKE_BINARY_DIR}/pthread-compile-tests"
- "${CMAKE_CURRENT_LIST_DIR}/test-pthread-getname.cpp"
- LINK_LIBRARIES Threads::Threads )
+try_compile(PTHREAD_GETNAME_NP_FOUND
+ SOURCES "${CMAKE_CURRENT_LIST_DIR}/test-pthread-getname.cpp"
+ LINK_LIBRARIES Threads::Threads
+)