CMake: Error required internal CMake variable not set

前端 未结 1 1857
自闭症患者
自闭症患者 2021-02-13 23:24

Windows 10, CMake 3.7.0, CUDA v8.0

CMake immediately fails to find anything. My CMake file looks as so:

cmake_minimum_required(VERSION 3.0)
find_package         


        
1条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-14 00:05

    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)
    

    0 讨论(0)
提交回复
热议问题