From 9e449e521456227477458999817c85bde00f0a0f Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Wed, 28 Jun 2017 13:23:45 +0200 Subject: cmake: move regex build instructions into subdirectory Extract code required to build the regex library into its own CMakeLists.txt, which is included as required. --- CMakeLists.txt | 7 ++++--- deps/regex/CMakeLists.txt | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 deps/regex/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index ab6077eea..1458bb893 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -453,8 +453,9 @@ ENDIF() # Include POSIX regex when it is required IF(WIN32 OR AMIGA OR CMAKE_SYSTEM_NAME MATCHES "(Solaris|SunOS)") - LIST(APPEND LBIGIT2_INCLUDES "${CMAKE_SOURCE_DIR}/deps/regex") - SET(SRC_REGEX "${CMAKE_SOURCE_DIR}/deps/regex/regex.c") + ADD_SUBDIRECTORY("${CMAKE_SOURCE_DIR}/deps/regex" "${CMAKE_BINARY_DIR}/deps/regex") + LIST(APPEND LIBGIT2_INCLUDES "${CMAKE_SOURCE_DIR}/deps/regex") + LIST(APPEND LIBGIT2_LIBS regex) ENDIF() # Optional external dependency: http-parser @@ -599,7 +600,7 @@ ENDIF() CONFIGURE_FILE(src/features.h.in git2/sys/features.h) -SET(GIT2INTERNAL_OBJECTS ${SRC_H} ${SRC_GIT2} ${SRC_OS} ${SRC_ZLIB} ${SRC_HTTP} ${SRC_REGEX} ${SRC_SSH} ${SRC_SHA1}) +SET(GIT2INTERNAL_OBJECTS ${SRC_H} ${SRC_GIT2} ${SRC_OS} ${SRC_ZLIB} ${SRC_HTTP} ${SRC_SSH} ${SRC_SHA1}) LIST(APPEND LIBGIT2_INCLUDES ${CMAKE_CURRENT_BINARY_DIR} "${CMAKE_SOURCE_DIR}/src" "${CMAKE_SOURCE_DIR}/include") diff --git a/deps/regex/CMakeLists.txt b/deps/regex/CMakeLists.txt new file mode 100644 index 000000000..6ef8a270f --- /dev/null +++ b/deps/regex/CMakeLists.txt @@ -0,0 +1,2 @@ +INCLUDE_DIRECTORIES(".") +ADD_LIBRARY(regex STATIC "regex.c" "regex.h") -- cgit v1.2.1