![构建 matplotlib-cpp 时出现的问题](https://linux22.com/image/1067954/%E6%9E%84%E5%BB%BA%20matplotlib-cpp%20%E6%97%B6%E5%87%BA%E7%8E%B0%E7%9A%84%E9%97%AE%E9%A2%98.png)
我下载了matplotlib-cpp 我创建了一个 CMakeList.txt 来构建它。CmakeList.txt 的内容
project(myproject)
find_package(Python2 COMPONENTS Development NumPy)
target_include_directories(myproject PRIVATE ${Python2_INCLUDE_DIRS} ${Python2_NumPy_INCLUDE_DIRS})
target_link_libraries(myproject Python2::Python Python2::NumPy)
但是我一按下命令cmake ../
就会收到这个错误
-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Python2: /usr/lib/python2.7/config-x86_64-linux-gnu/libpython2.7.so (found version "2.7.17") found components: Development NumPy Interpreter
CMake Error at CMakeLists.txt:3 (target_include_directories):
Cannot specify include directories for target "myproject" which is not
built by this project.
CMake Error at CMakeLists.txt:4 (target_link_libraries):
Cannot specify link libraries for target "myproject" which is not built by
this project.
CMake Error in CMakeLists.txt:
No cmake_minimum_required command is present. A line of code such as
cmake_minimum_required(VERSION 3.16)
should be added at the top of the file. The version specified may be lower
if you wish to support older CMake versions for this project. For more
information run "cmake --help-policy CMP0000".
-- Configuring incomplete, errors occurred!
See also "/home/heisenbug/myproject/build/CMakeFiles/CMakeOutput.log".
我可以就这个问题获得一些帮助吗?我认为问题在于名字myproject