mirror of
https://github.com/PCRE2Project/pcre2.git
synced 2025-10-17 15:25:55 +08:00

Additionally, I have attempted to clean up some CMake issues to make the package's build interface cleaner, in particular, avoiding polluting the parent directory's include path with our config.h file (if PCRE2 is being included as a subdirectory). This re-adds changes from Theodore's commit:def175f4a9
and partially reverts changes from Carlo's commit:92d56a1f7c
--------- Co-authored-by: Theodore Tsirpanis <teo@tsirpanis.gr>
21 lines
745 B
CMake
21 lines
745 B
CMake
cmake_minimum_required(VERSION 3.15)
|
|
project(TestInstallInterface C)
|
|
set(CMAKE_C_STANDARD 99)
|
|
set(CMAKE_C_STANDARD_REQUIRED TRUE)
|
|
|
|
# To test the static interface, uncomment the following line:
|
|
# set(PCRE2_USE_STATIC_LIBS ON)
|
|
find_package(PCRE2 REQUIRED CONFIG)
|
|
|
|
add_executable(test_executable main.c)
|
|
target_link_libraries(test_executable PRIVATE PCRE2::8BIT)
|
|
|
|
if(WIN32 AND CMAKE_VERSION VERSION_GREATER_EQUAL 3.21 AND NOT PCRE2_USE_STATIC_LIBS)
|
|
# Ensure that the DLLs are available for the executable to run. Only needed
|
|
# on Windows.
|
|
add_custom_command(TARGET test_executable POST_BUILD
|
|
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_RUNTIME_DLLS:test_executable> $<TARGET_FILE_DIR:test_executable>
|
|
COMMAND_EXPAND_LISTS
|
|
)
|
|
endif()
|