Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake: add headers to interface library #1057

Open
wants to merge 1 commit into
base: cpp_master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ PROJECT (msgpack-cxx LANGUAGES CXX)

ADD_LIBRARY (msgpack-cxx INTERFACE)

IF (CMAKE_VERSION VERSION_GREATER_EQUAL 3.19)
FILE(GLOB_RECURSE SOURCE_FILES include/*hpp)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
FILE(GLOB_RECURSE SOURCE_FILES include/*hpp)
FILE(GLOB_RECURSE SOURCE_FILES include/*.hpp)

I read https://cmake.org/cmake/help/v3.7/command/file.html globbing-expressions examples.
It seems that *.hpp can avoid unexpected match.

TARGET_SOURCES(msgpack-cxx PRIVATE ${SOURCE_FILES})
ENDIF()

FILE (READ ${CMAKE_CURRENT_SOURCE_DIR}/include/msgpack/version_master.hpp contents)
STRING (REGEX MATCH "#define MSGPACK_VERSION_MAJOR *([0-9a-zA-Z_]*)" NULL_OUT ${contents})
SET (VERSION_MAJOR ${CMAKE_MATCH_1})
Expand Down