Cmake issue : Target "cmTC_1bcff" requires the language dialect "CXX17" , but CMake does not know th

GROMACS version: 2022.4
GROMACS modification: Yes/No
Here post your question

Hi,

while running the cmake command from build directory, I am facing following issue,


cmake … -DGMX_BUILD_OWN_FFTW=ON -DREGRESSIONTEST_DOWNLOAD=ON -DCMAKE_INSTALL_PREFIX=/data/staff/makrand/mak/gromacs/INSTALL -DCMAKE_CXX_COMPILER=/usr/bin/gcc

CMake Error in /data/staff/makrand/mak/gromacs/gromacs-2022.4/build/CMakeFiles/CMakeTmp/CMakeLists.txt:
Target “cmTC_1bcff” requires the language dialect “CXX17” , but CMake does
not know the compile flags to use to enable it.

CMake Error at /data/staff/makrand/mak/CMAKE/cmake-3.16.3/INSTALL/share/cmake-3.16/Modules/FindOpenMP.cmake:201 (try_compile):
Failed to generate test project build system.
Call Stack (most recent call first):
/data/staff/makrand/mak/CMAKE/cmake-3.16.3/INSTALL/share/cmake-3.16/Modules/FindOpenMP.cmake:427 (_OPENMP_GET_FLAGS)
cmake/gmxManageOpenMP.cmake:41 (find_package)
CMakeLists.txt:295 (include)

– Configuring incomplete, errors occurred!
See also “/data/staff/makrand/mak/gromacs/gromacs-2022.4/build/CMakeFiles/CMakeOutput.log”.


Hi!

You are setting -DCMAKE_CXX_COMPILER=/usr/bin/gcc, but gcc is a C compiler, not C++. You should use -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++ instead.

Not related to your issue: 2022.5 is released, so we would suggest using it instead of an older version.