CMake: Error required internal CMake variable not set

Without a project() call, most of the CMake commands do not work. And find_package() is one of them.

Usually, only set() commands may precede project() call, all other commands should follow it:

cmake_minimum_required(VERSION 3.0)
project(MyProject) # <-- This defines many internal CMake variables, required for other commands.
find_package(CUDA REQUIRED)

Leave a Comment