From b37683789fb14bf62a6d4b7f44d51db3375879b0 Mon Sep 17 00:00:00 2001 From: Enrico Seiler Date: Tue, 8 Aug 2023 13:07:39 +0200 Subject: [PATCH] [INFRA] Ensure that CXX and C compilers are same major version --- CMakeLists.txt | 2 +- build_system/raptor-config.cmake | 14 ++++++++++++++ test/coverage/CMakeLists.txt | 2 +- test/header/CMakeLists.txt | 2 +- test/performance/CMakeLists.txt | 2 +- test/snippet/CMakeLists.txt | 2 +- test/unit/CMakeLists.txt | 2 +- util/applications/src/CMakeLists.txt | 2 +- util/iScience/CMakeLists.txt | 2 +- util/iScience/thresholding/CMakeLists.txt | 2 +- 10 files changed, 23 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3d1b2ec4..44796176 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,7 @@ list (APPEND CMAKE_MODULE_PATH "${RAPTOR_MODULE_PATH}") include (raptor-config-version) project (raptor - LANGUAGES CXX + LANGUAGES CXX C VERSION "${RAPTOR_PROJECT_VERSION}" DESCRIPTION "Raptor -- A fast and space-efficient pre-filter for querying very large collections of nucleotide sequences" HOMEPAGE_URL "https://github.com/seqan/raptor" diff --git a/build_system/raptor-config.cmake b/build_system/raptor-config.cmake index 18de1c09..758f1343 100644 --- a/build_system/raptor-config.cmake +++ b/build_system/raptor-config.cmake @@ -112,6 +112,20 @@ macro (raptor_config_error text) endif () endmacro () +# ---------------------------------------------------------------------------- +# Check CXX and C compiler versions (xxHash uses C). +# ---------------------------------------------------------------------------- + +string (REGEX MATCH "^[0-9]+" RAPTOR_CXX_MAJOR_VERSION "${CMAKE_CXX_COMPILER_VERSION}") +string (REGEX MATCH "^[0-9]+" RAPTOR_C_MAJOR_VERSION "${CMAKE_C_COMPILER_VERSION}") +if (NOT "${RAPTOR_CXX_MAJOR_VERSION}" STREQUAL "${RAPTOR_C_MAJOR_VERSION}") + raptor_config_error ("CXX and C compiler major versions differ (${RAPTOR_CXX_MAJOR_VERSION} and\ + ${RAPTOR_C_MAJOR_VERSION})! This will likely result in linker errors. Please set both\ + -DCMAKE_CXX_COMPILER and -DCMAKE_C_COMPILER to use the same major version, and/or set the\ + environment variables CXX and CC accordingly." + ) +endif () + # ---------------------------------------------------------------------------- # Find RAPTOR include path # ---------------------------------------------------------------------------- diff --git a/test/coverage/CMakeLists.txt b/test/coverage/CMakeLists.txt index cd4a7ac0..9c47996f 100644 --- a/test/coverage/CMakeLists.txt +++ b/test/coverage/CMakeLists.txt @@ -7,7 +7,7 @@ cmake_minimum_required (VERSION 3.18) -project (raptor_test_coverage CXX) +project (raptor_test_coverage LANGUAGES CXX C) include (../cmake/raptor_require_ccache.cmake) raptor_require_ccache () diff --git a/test/header/CMakeLists.txt b/test/header/CMakeLists.txt index 1d641339..b3b0d624 100644 --- a/test/header/CMakeLists.txt +++ b/test/header/CMakeLists.txt @@ -7,7 +7,7 @@ cmake_minimum_required (VERSION 3.10) -project (raptor_test_header CXX) +project (raptor_test_header LANGUAGES CXX C) include (../raptor-test.cmake) include (GoogleTest OPTIONAL) diff --git a/test/performance/CMakeLists.txt b/test/performance/CMakeLists.txt index 9f1551e3..fef500a0 100644 --- a/test/performance/CMakeLists.txt +++ b/test/performance/CMakeLists.txt @@ -7,7 +7,7 @@ cmake_minimum_required (VERSION 3.10) -project (raptor_test_performance CXX) +project (raptor_test_performance LANGUAGES CXX C) option (BUILD_RAPTOR_APP_FOR_TEST "" OFF) include (../raptor-test.cmake) diff --git a/test/snippet/CMakeLists.txt b/test/snippet/CMakeLists.txt index b768b16f..72f67743 100644 --- a/test/snippet/CMakeLists.txt +++ b/test/snippet/CMakeLists.txt @@ -6,7 +6,7 @@ # -------------------------------------------------------------------------------------------------------- cmake_minimum_required (VERSION 3.10...3.22) -project (raptor_test_snippet CXX) +project (raptor_test_snippet LANGUAGES CXX C) include (../raptor-test.cmake) include (raptor_test_component) diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt index 3c7f2bf8..10478b93 100644 --- a/test/unit/CMakeLists.txt +++ b/test/unit/CMakeLists.txt @@ -7,7 +7,7 @@ cmake_minimum_required (VERSION 3.10) -project (raptor_test_unit CXX) +project (raptor_test_unit LANGUAGES CXX C) include (../raptor-test.cmake) include (GoogleTest OPTIONAL) diff --git a/util/applications/src/CMakeLists.txt b/util/applications/src/CMakeLists.txt index 28f6d845..e98ff7bd 100644 --- a/util/applications/src/CMakeLists.txt +++ b/util/applications/src/CMakeLists.txt @@ -9,7 +9,7 @@ list (APPEND CMAKE_MODULE_PATH "${RAPTOR_CLONE_DIR}/build_system") include (raptor-config-version) -project (raptor_utility_common LANGUAGES CXX) +project (raptor_utility_common LANGUAGES CXX C) find_package (Raptor REQUIRED HINTS ${RAPTOR_CLONE_DIR}/build_system) diff --git a/util/iScience/CMakeLists.txt b/util/iScience/CMakeLists.txt index 7ca93adf..e18f60bc 100644 --- a/util/iScience/CMakeLists.txt +++ b/util/iScience/CMakeLists.txt @@ -16,7 +16,7 @@ list (APPEND CMAKE_MODULE_PATH "${RAPTOR_CLONE_DIR}/build_system") include (raptor-config-version) -project (raptor_utility_common LANGUAGES CXX) +project (raptor_utility_common LANGUAGES CXX C) find_package (Raptor REQUIRED HINTS ${RAPTOR_CLONE_DIR}/build_system) diff --git a/util/iScience/thresholding/CMakeLists.txt b/util/iScience/thresholding/CMakeLists.txt index 2046d3a9..d8ca2dba 100644 --- a/util/iScience/thresholding/CMakeLists.txt +++ b/util/iScience/thresholding/CMakeLists.txt @@ -8,7 +8,7 @@ cmake_minimum_required (VERSION 3.18) # Define the application name. -project (minimizer_thresholds CXX) +project (minimizer_thresholds LANGUAGES CXX C) # Make Release default build type if (NOT CMAKE_BUILD_TYPE)