optimad / bitpit

Open source library for scientific HPC
http://optimad.github.io/bitpit/
GNU Lesser General Public License v3.0
117 stars 34 forks source link

CMake error : `check_compiler_flag: C: needs to be enabled before use.` #351

Closed arnodu closed 1 year ago

arnodu commented 1 year ago

On master (56632bcf0ccc), when compiling with PABLO only :

$ cmake -DBITPIT_ENABLE_MPI=ON -DBITPIT_MODULE_LA=OFF -DBITPIT_MODULE_CG=OFF -DBITPIT_MODULE_DISCRETIZATION=OFF -DBITPIT_MODULE_LEVELSET=OFF -DBITPIT_MODULE_PATCHKERNEL=OFF -DBITPIT_MODULE_POD=OFF -DBITPIT_MODULE_RBF=OFF -DBITPIT_MODULE_SA=OFF -DBITPIT_MODULE_SURFUNSTRUCTURED=OFF -DBITPIT_MODULE_VOLCARTESIAN=OFF -DBITPIT_MODULE_VOLOCTREE=OFF -DBITPIT_MODULE_VOLUNSTRUCTURED=OFF -DBITPIT_MODULE_POINTCLOUD=OFF -DBITPIT_MODULE_LINEUNSTRUCTURED=OFF -DBITPIT_MODULE_PABLO=ON ..
-- The CXX compiler identification is GNU 12.2.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found LibXml2: /usr/lib/libxml2.so (found version "2.10.2") 
-- RapidJSON found. Headers: /usr/include
CMake Error at /usr/share/cmake/Modules/Internal/CheckFlagCommonConfig.cmake:58 (message):
  check_compiler_flag: C: needs to be enabled before use.
Call Stack (most recent call first):
  /usr/share/cmake/Modules/Internal/CheckCompilerFlag.cmake:13 (cmake_check_flag_common_init)
  /usr/share/cmake/Modules/CheckCCompilerFlag.cmake:40 (cmake_check_compiler_flag)
  CMakeLists.txt:1001 (check_c_compiler_flag)

CMake Error at /usr/share/cmake/Modules/Internal/CheckFlagCommonConfig.cmake:58 (message):
  check_compiler_flag: C: needs to be enabled before use.
Call Stack (most recent call first):
  /usr/share/cmake/Modules/Internal/CheckCompilerFlag.cmake:13 (cmake_check_flag_common_init)
  /usr/share/cmake/Modules/CheckCCompilerFlag.cmake:40 (cmake_check_compiler_flag)
  CMakeLists.txt:1001 (check_c_compiler_flag)

-- Performing Test CXX_COMPILER_SUPPORTS_SANITIZE_MODULE
-- Performing Test CXX_COMPILER_SUPPORTS_SANITIZE_MODULE - Success
-- Performing Test HAVE___BUILTIN_UNREACHABLE
-- Performing Test HAVE___BUILTIN_UNREACHABLE - Success
-- Configuring incomplete, errors occurred!
See also "/<...>l/bitpit/build/CMakeFiles/CMakeOutput.log".

You should either check if C is enabled in the CMakeLists.txt here before using check_c_compiler_flag , of just enable C with project("bitpit" C CXX) at the top of the file.