I have downloaded a library that I have built using the MakeFile provided in the .zip. Now, I am trying to build my own project and link that library using CMake. This is what I have tried so far:
cmake_minimum_required(VERSION 3.10)
project(GraphicsStanfordExample)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_VERBOSE_MAKEFILE ON)
find_library(CPPLIB NAMES libStanfordCPPLib StanfordCPPLib PATHS ${CMAKE_SOURCE_DIR}/cpplib/lib)
if(NOT CPPLIB)
message(FATAL_ERROR "cpplib library not found")
endif()
add_executable(graphics_example graphics_example.cpp)
target_link_libraries(graphics_example ${CPPLIB})
The problem here is that it builds and CPPLIB returns True. When I open the project in VS code the header files are found but when I try to compile I get the error: fatal error: gwindow.h: No such file or directory
Clearly I am missing something since the libraries are located by CMake and the IDE but not by the compiler. This is being done in Ubuntu and by generating Unix MakeFiles.
Some help would be appreciated,
Thanks!
question from:
https://stackoverflow.com/questions/65853420/how-to-link-prebuilt-libraries-with-cmake 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…