summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2017-06-28 13:23:45 +0200
committerPatrick Steinhardt <ps@pks.im>2017-08-16 07:12:38 +0200
commit9e449e521456227477458999817c85bde00f0a0f (patch)
tree7050fd0a14de4318ae0daeb5d90b24ea8883f592
parent432485001593d25c6900acbd17f089e056ce91d2 (diff)
downloadlibgit2-9e449e521456227477458999817c85bde00f0a0f.tar.gz
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.
-rw-r--r--CMakeLists.txt7
-rw-r--r--deps/regex/CMakeLists.txt2
2 files changed, 6 insertions, 3 deletions
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")