Thursday, July 28, 2022

[SOLVED] Getting "Could not find cmake module file: CMakeDetermineVersionCompiler.cmake" with cmake in linux

Issue

I'm getting Could not find cmake module file: CMakeDetermineVersionCompiler.cmake after installing cmake via script from website. What am I missing and where/what commands to run to fix this issue.

install cmd:

sudo ./cmake.sh --prefix=/usr/local/ --exclude-subdir

CMakeLists.txt:

cmake_minimum_required(VERSION 3.12)

project(Hello Version 1.0)

add_executable(${PROJECT_NAME} ../src/main.cpp)

Version: cmake version 3.16.6 (I also tried the latest version 3.17.2 too)

OS: Linux Mint 19 Cinnamon


Solution

Inside CMake commands all options have case-sensitive names, which are usually upper-case. So, it is incorrectly to write Version instead of VERSION. Correct:

project(Hello VERSION 1.0)

See documentation for project command.



Answered By - Tsyvarev
Answer Checked By - David Marino (WPSolving Volunteer)