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 2026/10/10 03:10:52 UTC

(logging-log4cxx) branch add_cxx_compiler_check created (now 200f3946)

This is an automated email from the ASF dual-hosted git repository.

swebb2066 pushed a change to branch add_cxx_compiler_check
in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git


      at 200f3946 Add a check to ensure CMAKE_CXX_COMPILER is valid

This branch includes the following new commits:

     new 200f3946 Add a check to ensure CMAKE_CXX_COMPILER is valid

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(logging-log4cxx) 01/01: Add a check to ensure CMAKE_CXX_COMPILER is valid

Posted by sw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

swebb2066 pushed a commit to branch add_cxx_compiler_check
in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git

commit 200f394618a568190c664fccb86e378999883c19
Author: Stephen Webb <sw...@gmail.com>
AuthorDate: Sat Oct 10 14:10:30 2026 +1100

    Add a check to ensure CMAKE_CXX_COMPILER is valid
---
 .../compiler-features/check-compiler-support.cmake     |  8 ++++++++
 src/cmake/compiler-features/test_cxx_compiler.cpp      | 18 ++++++++++++++++++
 2 files changed, 26 insertions(+)

diff --git a/src/cmake/compiler-features/check-compiler-support.cmake b/src/cmake/compiler-features/check-compiler-support.cmake
index b99f9ea8..15811531 100644
--- a/src/cmake/compiler-features/check-compiler-support.cmake
+++ b/src/cmake/compiler-features/check-compiler-support.cmake
@@ -1,5 +1,13 @@
 # This module checks compiler and standard library support
 #
+# Attempt to compile and link a basic C++ standard library feature
+try_compile(CXX_FRONTEND_IS_VALID "${CMAKE_BINARY_DIR}/Testing/test_cxx_compiler"
+    "${CMAKE_CURRENT_LIST_DIR}/test_cxx_compiler.cpp"
+    )
+if(NOT CXX_FRONTEND_IS_VALID)
+    message(FATAL_ERROR "The CXX compiler cannot link C++ standard library features. Ensure CMAKE_CXX_COMPILER is pointing to a C++ frontend (e.g., clang++ instead of clang).")
+endif()
+
 include(CheckCXXCompilerFlag)
 
 # Does the compiler support the Safe Buffers diagnostic -Wunsafe-buffer-usage?
diff --git a/src/cmake/compiler-features/test_cxx_compiler.cpp b/src/cmake/compiler-features/test_cxx_compiler.cpp
new file mode 100644
index 00000000..76f2b808
--- /dev/null
+++ b/src/cmake/compiler-features/test_cxx_compiler.cpp
@@ -0,0 +1,18 @@
+#include <string>
+#include <vector>
+#include <iostream>
+
+int main(int argc, char** argv){
+	std::vector<std::string> test
+	{ std::string("Hello")
+	, std::string(" ")
+	, std::string("world!.")
+	, std::string("\n")
+	, std::string("A long string that ensures dynamic memeory is needed")
+	};
+	for (auto item : test)
+		std::cout << item;
+	std::cout << '\n';
+	return 0;
+}
+