CMake BUILD 未定义引用findpng

问题描述

我对 CMake 还是很陌生,所以绝对欢迎反馈。因此,我正在尝试构建一个简单的应用程序,该应用程序最终应该使用库 libharu 创建一个 pdf。

我想我想出了如何链接库。但我仍然收到 findpng 模块的构建错误(我想 libharu 取决于它)

build

CMakeLists.txt:

cmake_minimum_required(VERSION 3.2.0 FATAL_ERROR)     # current latest stable version (if lower give FATAL_ERROR)
project(pdf_generator VERSION 0.1.0)                  # name of the project,version.

file(GLOB TARGET_SRC "./src/*.cpp")                   # Creates variable,using globbing.

include_directories(${PROJECT_SOURCE_DIR}/include)    # list of directories to be used as header search paths.
add_executable(main ${TARGET_SRC})                    # Create an executable of set of source files [exe name files to bundle].



find_library(libhpdf_location NAMES libhpdf.a)        # find the location of libhpdf.a and save the value in the variable libhpdf_location.
message(STATUS ${libhpdf_location})                   # print status of variable.

add_library(libhpdf STATIC IMPORTED)                  # Add library via a static import.
set_target_properties(
  libhpdf PROPERTIES
  IMPORTED_LOCATION ${libhpdf_location}
)

target_link_libraries(main libhpdf)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)