No CMAKE_LANGUAGE_COMPILER could be found.
I met some trouble when i try to create dir of build , i type cmake -B build
, then error occur。
I google this mistake but cannot found
environment:
cs144@cs144vm ~/w/c/test> cmake -B build
CMake Error: Could not find cmake module file: CMakeDetermineLANGUAGECompiler.cmake
CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
Missing variable is:
CMAKE_LANGUAGE_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
Missing variable is:
CMAKE_LANGUAGE_COMPILER
CMake Error: Could not find cmake module file: /home/cs144/workspace/cmake-3.25.1-tutorial-source/test/build/CMakeFiles/3.25.1/CMakeLANGUAGECompiler.cmake
-- The CXX compiler identification is GNU 7.5.0
-- The C compiler identification is GNU 7.5.0
CMake Error at CMakeLists.txt:16 (project):
No CMAKE_LANGUAGE_COMPILER could be found.
Tell CMake where to find the compiler by setting the CMake cache entry
CMAKE_LANGUAGE_COMPILER to the full path to the compiler, or to the
compiler name if it is in the PATH.
CMake Error: Could not find cmake module file: CMakeLANGUAGEInformation.cmake
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
CMake Error: CMAKE_LANGUAGE_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
See also "/home/cs144/workspace/cmake-3.25.1-tutorial-source/test/build/CMakeFiles/CMakeOutput.log".
my CMakeLists.txt
cmake_minimum_required(VERSION 3.20)
set(CXX_STANDARD 11)
set(CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS ON)
project(testlib LANGUAGE CXX C)
add_executable(main)
file(GLOB sources CONFIGURE_DEPENDS *.cpp *.h )
target_sources(main PUBLIC ${sources})
Edited by justforfun