环境
- 操作系统:macos
- 包管理器:自制
- 构建工具:cmake、pkg-config、clang
- 存储库:https ://github.com/xedit/xedit
它们都是最新版本。
CMakeLists.txt
CMakeLists.txt 是:
project(xeditd LANGUAGES CXX VERSION 0.1)
find_package(PkgConfig REQUIRED)
pkg_search_module(ICU_UC icu-uc)
pkg_search_module(SPDLOG spdlog)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wall")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ICU_UC_CXXFLAGS_OTHER}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SPDLOG_CXXFLAGS_OTHER}")
set(SRC_FILE
xeditd.cpp
)
set(LIB_DIR
${ICU_UC_LIBRARY_DIRS}
${SPDLOG_LIBRARY_DIRS}
)
set(LIB
${ICU_UC_LIBRARIES}
${SPDLOG_LIBRARIES}
)
set(INC_DIR
${ICU_UC_INCLUDE_DIRS}
${SPDLOG_INCLUDE_DIRS}
)
message(ICU_UC_CXXFLAGS_OTHER: ${ICU_UC_CXXFLAGS_OTHER})
message(SPDLOG_CXXFLAGS_OTHER: ${SPDLOG_CXXFLAGS_OTHER})
message(ICU_UC_LIBRARY_DIRS: ${ICU_UC_LIBRARY_DIRS})
message(SPDLOG_LIBRARY_DIRS: ${SPDLOG_LIBRARY_DIRS})
message(ICU_UC_LIBRARIES: ${ICU_UC_LIBRARIES})
message(SPDLOG_LIBRARIES: ${SPDLOG_LIBRARIES})
message(ICU_UC_INCLUDE_DIRS: ${ICU_UC_INCLUDE_DIRS})
message(SPDLOG_INCLUDE_DIRS: ${SPDLOG_INCLUDE_DIRS})
link_directories(${LIB_DIR})
add_executable(xeditd ${SRC_FILE})
target_include_directories(xeditd PUBLIC ${INC_DIR})
target_link_libraries(xeditd ${LIB})
错误
消息显示:
ICU_UC_CXXFLAGS_OTHER:
SPDLOG_CXXFLAGS_OTHER:
ICU_UC_LIBRARY_DIRS:/usr/local/Cellar/icu4c/64.2/lib
SPDLOG_LIBRARY_DIRS:
ICU_UC_LIBRARIES:icuucicudata
SPDLOG_LIBRARIES:
ICU_UC_INCLUDE_DIRS:/usr/local/Cellar/icu4c/64.2/include
SPDLOG_INCLUDE_DIRS:
<spdlog/spdlog.h>
找不到头文件。显然 spdlog 头目录不包含在 cmake 中。
问题
为什么 pkg_search_module 适用于icu4c
,错误不适用于spdlog
?而不是为了pthread
?