Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
94243295
Commit
94243295
authored
Dec 18, 2012
by
Sascha Cunz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DRY: Add function that adds os-specific libraries to our targets
parent
19a766a2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
14 deletions
+15
-14
CMakeLists.txt
+15
-14
No files found.
CMakeLists.txt
View file @
94243295
...
...
@@ -41,6 +41,17 @@ SET(BIN_INSTALL_DIR bin CACHE PATH "Where to install binaries to.")
SET
(
LIB_INSTALL_DIR lib CACHE PATH
"Where to install libraries to."
)
SET
(
INCLUDE_INSTALL_DIR include CACHE PATH
"Where to install headers to."
)
FUNCTION
(
TARGET_OS_LIBRARIES target
)
IF
(
WIN32
)
TARGET_LINK_LIBRARIES
(
${
target
}
ws2_32
)
ELSEIF
(
CMAKE_SYSTEM_NAME MATCHES
"(Solaris|SunOS)"
)
TARGET_LINK_LIBRARIES
(
${
target
}
socket nsl
)
ENDIF
()
IF
(
THREADSAFE
)
TARGET_LINK_LIBRARIES
(
${
target
}
${
CMAKE_THREAD_LIBS_INIT
}
)
ENDIF
()
ENDFUNCTION
()
FILE
(
STRINGS
"include/git2/version.h"
GIT2_HEADER REGEX
"^#define LIBGIT2_VERSION
\"
[^
\"
]*
\"
$"
)
STRING
(
REGEX REPLACE
"^.*LIBGIT2_VERSION
\"
([0-9]+).*$"
"
\\
1"
LIBGIT2_VERSION_MAJOR
"
${
GIT2_HEADER
}
"
)
...
...
@@ -172,14 +183,9 @@ FILE(GLOB SRC_GIT2 src/*.c src/transports/*.c src/xdiff/*.c)
# Compile and link libgit2
ADD_LIBRARY
(
git2
${
SRC_GIT2
}
${
SRC_OS
}
${
SRC_ZLIB
}
${
SRC_HTTP
}
${
SRC_REGEX
}
${
SRC_SHA1
}
${
WIN_RC
}
)
TARGET_LINK_LIBRARIES
(
git2
${
SSL_LIBRARIES
}
)
TARGET_OS_LIBRARIES
(
git2
)
IF
(
WIN32
)
TARGET_LINK_LIBRARIES
(
git2 ws2_32
)
ELSEIF
(
CMAKE_SYSTEM_NAME MATCHES
"(Solaris|SunOS)"
)
TARGET_LINK_LIBRARIES
(
git2 socket nsl
)
ENDIF
()
TARGET_LINK_LIBRARIES
(
git2
${
CMAKE_THREAD_LIBS_INIT
}
${
SSL_LIBRARIES
}
)
SET_TARGET_PROPERTIES
(
git2 PROPERTIES VERSION
${
LIBGIT2_VERSION_STRING
}
)
SET_TARGET_PROPERTIES
(
git2 PROPERTIES SOVERSION
${
LIBGIT2_VERSION_MAJOR
}
)
CONFIGURE_FILE
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/libgit2.pc.in
${
CMAKE_CURRENT_BINARY_DIR
}
/libgit2.pc @ONLY
)
...
...
@@ -221,19 +227,14 @@ IF (BUILD_CLAR)
WORKING_DIRECTORY
${
CLAR_PATH
}
)
ADD_EXECUTABLE(libgit2_clar
${
SRC_GIT2
}
${
SRC_OS
}
${
CLAR_PATH
}
/clar_main.c
${
SRC_TEST
}
${
SRC_ZLIB
}
${
SRC_HTTP
}
${
SRC_REGEX
}
${
SRC_SHA1
}
)
TARGET_LINK_LIBRARIES(libgit2_clar
${
CMAKE_THREAD_LIBS_INIT
}
${
SSL_LIBRARIES
}
)
TARGET_LINK_LIBRARIES(libgit2_clar
${
SSL_LIBRARIES
}
)
TARGET_OS_LIBRARIES(libgit2_clar)
IF (MSVC_IDE)
# Precompiled headers
SET_TARGET_PROPERTIES(libgit2_clar PROPERTIES COMPILE_FLAGS "
/Yuprecompiled.h /FIprecompiled.h
")
ENDIF ()
IF (WIN32)
TARGET_LINK_LIBRARIES(libgit2_clar ws2_32)
ELSEIF (CMAKE_SYSTEM_NAME MATCHES "
(
Solaris|SunOS
)
")
TARGET_LINK_LIBRARIES(libgit2_clar socket nsl)
ENDIF ()
ENABLE_TESTING()
ADD_TEST(libgit2_clar libgit2_clar -iall)
ENDIF ()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment