Skip to content

Compilation error on Archlinux with cmake=4.0.3 #178

@mschubert

Description

@mschubert

I'm getting the following error from cmake (version 4.0.3) on Arch Linux:

-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at /usr/share/cmake/Modules/Internal/CheckSourceCompiles.cmake:47 (message):
  check_source_compiles: C: needs to be enabled before use.
Call Stack (most recent call first):
  /usr/share/cmake/Modules/CheckCSourceCompiles.cmake:58 (cmake_check_source_compiles)
  CMakeModules/FindLIBXML.cmake:115 (CHECK_C_SOURCE_COMPILES)
  /usr/share/cmake/Modules/CMakeFindDependencyMacro.cmake:78 (find_package)
  /usr/lib/cmake/sbml-static-config.cmake:14 (find_dependency)
  CMakeModules/FindLIBSBML.cmake:40 (find_package)
  CMakeLists.txt:341 (find_package)

I can make compilation succeed with the following change in libSEDML's CMakeLists.txt:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9b8f477..55064e7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -73,7 +73,7 @@ set(LIBSEDML_DOTTED_VERSION ${LIBSEDML_VERSION})
 set(PACKAGE_NAME "libSEDML")
 
 project (libsedml VERSION "${LIBSEDML_VERSION_MAJOR}.${LIBSEDML_VERSION_MINOR}.${LIBSEDML_VERSION_PATCH}"
-                  LANGUAGES CXX)
+                  LANGUAGES C CXX)
 
 set(CMAKE_CXX_STANDARD 11)
 set(CMAKE_CXX_STANDARD_REQUIRED YES)

However, there may be a better solution given the CMake traceback.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions