finding pcre2, yet another attempt

This commit is contained in:
Maarten L. Hekkelman
2025-08-26 13:31:12 +02:00
parent 8944906fd2
commit 924f7c1505
3 changed files with 24 additions and 11 deletions

View File

@@ -321,7 +321,7 @@ target_include_directories(
PRIVATE "${EIGEN_INCLUDE_DIR}")
target_link_libraries(cifpp
PUBLIC Threads::Threads ZLIB::ZLIB $<$<TARGET_EXISTS:std::atomic>:std::atomic> pcre2-8)
PUBLIC Threads::Threads ZLIB::ZLIB $<$<TARGET_EXISTS:std::atomic>:std::atomic> $<BUILD_INTERFACE:pcre2-8>)
if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
target_link_options(cifpp PRIVATE -undefined dynamic_lookup)

View File

@@ -19,15 +19,10 @@ else()
endif()
if(NOT PCRE2_FOUND)
message(STATUS "Using pcre2 using FetchContent")
find_path(PCRE2_INCLUDEDIR NAMES pcre2.h REQUIRED)
find_library(PCRE2_LIBRARY NAMES pcre2-8-static pcre2-8 REQUIRED)
set(PCRE2_BUILD_TESTS OFF)
FetchContent_Declare(
pcre2
GIT_REPOSITORY https://github.com/PCRE2Project/pcre2
GIT_TAG pcre2-10.45
EXCLUDE_FROM_ALL)
FetchContent_MakeAvailable(pcre2)
# add_subdirectory(${pcre2_SOURCE_DIR} EXCLUDE_FROM_ALL)
add_library(pcre2-8 SHARED IMPORTED)
set_target_properties(pcre2-8 PROPERTIES INCLUDE_DIRECTORIES ${PCRE2_INCLUDEDIR})
set_target_properties(pcre2-8 PROPERTIES IMPORTED_LOCATION ${PCRE2_LIBRARY})
endif()

View File

@@ -1,10 +1,13 @@
@ECHO OFF
SET ZLIB_VERSION=1.3
SET PCRE2_VERSION=10.45
IF NOT EXIST build_ci\libs (
MKDIR build_ci\libs
)
CD build_ci\libs
@REM Install ZLib
IF NOT EXIST zlib-%ZLIB_VERSION%.zip (
ECHO Downloading https://github.com/libarchive/zlib/archive/v%ZLIB_VERSION%.zip
curl -L -o zlib-%ZLIB_VERSION%.zip https://github.com/libarchive/zlib/archive/v%ZLIB_VERSION%.zip || EXIT /b 1
@@ -19,4 +22,19 @@ cmake --build . --target ALL_BUILD --config Release || EXIT /b 1
cmake --build . --target RUN_TESTS --config Release || EXIT /b 1
cmake --build . --target INSTALL --config Release || EXIT /b 1
@REM Install PCRE2
IF NOT EXIST pcre2-%PCRE2_VERSION%.zip (
ECHO Downloading https://github.com/PCRE2Project/pcre2/releases/download/pcre2-%PCRE2_VERSION%/pcre2-%PCRE2_VERSION%.zip
curl -L -o pcre2-%PCRE2_VERSION%.zip https://github.com/PCRE2Project/pcre2/releases/download/pcre2-%PCRE2_VERSION%/pcre2-%PCRE2_VERSION%.zip || EXIT /b 1
)
IF NOT EXIST pcre2-%PCRE2_VERSION% (
ECHO Unpacking pcre2-%PCRE2_VERSION%.zip
C:\windows\system32\tar.exe -x -f pcre2-%PCRE2_VERSION%.zip || EXIT /b 1
)
CD pcre2-%PCRE2_VERSION%
cmake -G "Visual Studio 17 2022" . || EXIT /b 1
cmake --build . --target ALL_BUILD --config Release || EXIT /b 1
cmake --build . --target RUN_TESTS --config Release || EXIT /b 1
cmake --build . --target INSTALL --config Release || EXIT /b 1
@EXIT /b 0