0
我試圖使用CheckIncludeFileCXX
模塊來驗證<gsl/gsl>
是否存在於系統中。 GSL存在於/usr/local/include/gsl/gsl
但一代又在"GSL not found"
CheckIncludeFileCXX找不到標題
project(cpp-binaries)
cmake_minimum_required(VERSION 3.2)
include(CheckIncludeFileCXX)
CHECK_INCLUDE_FILE_CXX("gsl/gsl" GSL_LIBRARY)
if(NOT GSL_LIBRARY)
message(FATAL_ERROR "GSL not found")
endif(NOT GSL_LIBRARY)
add_executable(
cpp-binaries
"main.cpp"
)
我對'GSL'不熟悉,但是您確定頭文件末尾沒有'.h'嗎?否則不要使用編譯器來查找頭文件,使用CMake模塊(在你的情況下['FindGSL'](https://cmake.org/cmake/help/latest/module/FindGSL.html))或['find_file ()'](https://cmake.org/cmake/help/latest/command/find_file.html)命令。或者嘗試先設置(CMAKE_REQUIRED_INCLUDES「/ usr/local/include」)。 – Florian
[GSL](https://github.com/Microsoft/GSL)是僅包含標題的庫,並且沒有.h。設置'CMAKE_REQUIRED_INCLUDES'後,它也無法工作 –