Skip to content

Commit

Permalink
Use PUBLIC_HEADER to install headers.
Browse files Browse the repository at this point in the history
Change-Id: I8d7a1b51deb35773d95af2ec1b7a866c8700f0d7
Reviewed-on: https://code-review.googlesource.com/c/re2/+/61030
Reviewed-by: Alex Chernyakhovsky <[email protected]>
Reviewed-by: Paul Wankadia <[email protected]>
  • Loading branch information
junyer committed Feb 13, 2023
1 parent 891fa66 commit d074884
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,19 @@ set(RE2_SOURCES
util/strutil.cc
)

set(RE2_HEADERS
re2/filtered_re2.h
re2/re2.h
re2/set.h
re2/stringpiece.h
)

add_library(re2 ${RE2_SOURCES})
target_compile_features(re2 PUBLIC cxx_std_11)
target_include_directories(re2 PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
# CMake gives "set_target_properties called with incorrect number of arguments."
# errors if we don't quote ${RE2_HEADERS}, so quote it despite prevailing style.
set_target_properties(re2 PROPERTIES PUBLIC_HEADER "${RE2_HEADERS}")
set_target_properties(re2 PROPERTIES SOVERSION ${SONAME} VERSION ${SONAME}.0.0)
add_library(re2::re2 ALIAS re2)

Expand Down Expand Up @@ -165,20 +175,12 @@ if(RE2_BUILD_TESTING)
endforeach()
endif()

set(RE2_HEADERS
re2/filtered_re2.h
re2/re2.h
re2/set.h
re2/stringpiece.h
)

install(FILES ${RE2_HEADERS}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/re2)
install(TARGETS re2
EXPORT re2Targets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/re2
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(EXPORT re2Targets
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/re2
Expand Down

0 comments on commit d074884

Please sign in to comment.