在适用cmake
构建项目的时候,突然遇到了这个报错
Make Error at CMakeLists.txt:1 (project):
VERSION not allowed unless CMP0048 is set to NEW
– Configuring incomplete, errors occurred!
make: *** No targets specified and no makefile found. Stop.
CMakeLists.txt
内容见下:
project(demo VERSION 1.0.0)cmake_minimum_required(VERSION 3.0)
查了半天,竟然没发现有人遇到同样的情况,在反复实验中发现
cmake_minimum_required()
要写在CMakeLists.txt
的第一行,否则就会报这样的错误
改写CMakeLists.txt
内容如下:
cmake_minimum_required(VERSION 3.0)project(demo VERSION 1.0.0)
就不报错了!