我的CMakeLists.txt是这样写的
cmake_minimum_required(VERSION 3.17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fexec-charset=GBK")
set(CMAKE_BUILD_TYPE Release) # 设置编译版本,Release或Debug
SET(CMAKE_C_COMPILER_WORKS 1)
SET(CMAKE_CXX_COMPILER_WORKS 1)
# =============== 以下配置为必须指定的配置 ================
set(CMAKE_MAKE_PROGRAM "D:\\Program Files\\CMake\\bin\\cmake.exe") # 配置cmake地址
set(CMAKE_C_COMPILER "F:/Program Files/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/bin/gcc.exe") # 配置gcc地址
set(CMAKE_CXX_COMPILER "F:/Program Files/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/bin/g++.exe") # 配置g++地址
project(MyPyMySQL)
# MySQL
set(MYSQL_BASE_DIR F:\\mysql-8.0.22 CACHE PATH "mysql server base direction") # MySQL server 安装目录
# boost
set(Boost_ROOT F:\\boost_1_74_0) # boost目录
set(BOOST_LIBS F:/boost_1_74_0/stage/lib) # boost动态链接库目录
if(CMAKE_BUILD_TYPE MATCHES Release)
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin/release)
ELSE()
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin/debug)
ENDIF()
## ===c++编译器配置
set(CMAKE_CXX_STANDARD 11) # 语言标准:c++11
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++20")
set(CMAKE_CXX_FLAGS "-fexec-charset=GBK") # 字符集
find_package(Python3)
find_package(PythonLibs)
find_package(Boost COMPONENTS python37 REQUIRED)
最后一行查找package,可以找到boost,但是找不到python37的组件,也拿不到响应的动态链接库,是为啥呢?