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
b02c371e
Commit
b02c371e
authored
Feb 02, 2011
by
Vicent Marti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Build the new test file with CMake too
Signed-off-by: Vicent Marti <tanoku@gmail.com>
parent
2a1732b4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
25 deletions
+5
-25
CMakeLists.txt
+5
-25
No files found.
CMakeLists.txt
View file @
b02c371e
...
@@ -34,7 +34,6 @@ SET(INSTALL_INC include CACHE PATH "Where to install headers to.")
...
@@ -34,7 +34,6 @@ SET(INSTALL_INC include CACHE PATH "Where to install headers to.")
# Build options
# Build options
OPTION
(
BUILD_SHARED_LIBS
"Build Shared Library (OFF for Static)"
ON
)
OPTION
(
BUILD_SHARED_LIBS
"Build Shared Library (OFF for Static)"
ON
)
OPTION
(
BUILD_TESTS
"Build Tests"
ON
)
OPTION
(
BUILD_TESTS
"Build Tests"
ON
)
OPTION
(
BACKTRACE
"Use GCC backtrace in tests (Not available on Cygwin/MinGW)"
OFF
)
# Build Release by default
# Build Release by default
IF
(
NOT CMAKE_BUILD_TYPE
)
IF
(
NOT CMAKE_BUILD_TYPE
)
...
@@ -56,11 +55,6 @@ IF (WIN32 AND NOT CYGWIN)
...
@@ -56,11 +55,6 @@ IF (WIN32 AND NOT CYGWIN)
ENDIF
()
ENDIF
()
ENDIF
()
ENDIF
()
# When desired build with backtrace
IF
(
BACKTRACE
)
ADD_DEFINITIONS
(
-DBACKTRACE
)
ENDIF
()
# Specify sha1 implementation
# Specify sha1 implementation
IF
(
SHA1_TYPE STREQUAL
"ppc"
)
IF
(
SHA1_TYPE STREQUAL
"ppc"
)
ADD_DEFINITIONS
(
-DPPC_SHA1
)
ADD_DEFINITIONS
(
-DPPC_SHA1
)
...
@@ -91,26 +85,12 @@ IF (BUILD_TESTS)
...
@@ -91,26 +85,12 @@ IF (BUILD_TESTS)
ADD_DEFINITIONS
(
-DTEST_RESOURCES=\
"
${
TEST_RESOURCES
}
\"
)
ADD_DEFINITIONS
(
-DTEST_RESOURCES=\
"
${
TEST_RESOURCES
}
\"
)
ENABLE_TESTING()
ENABLE_TESTING()
# Find and build all tests
INCLUDE_DIRECTORIES(tests)
INCLUDE_DIRECTORIES(tests)
FILE (GLOB TESTS tests/t????-*.c)
FOREACH (TEST_SRC
${
TESTS
}
)
FILE(GLOB SRC_TEST tests/t??-*.c
)
# Match the source to get test name
STRING(REGEX MATCH "
(
t....-.*
)
.c$
" TEST_NAME
${
TEST_SRC
}
)
ADD_EXECUTABLE(libgit2_test tests/test_main.c tests/test_lib.c tests/test_helpers.c
${
SRC
}
${
SRC_PLAT
}
${
SRC_SHA1
}
${
SRC_TEST
}
)
SET(TEST_NAME
${
CMAKE_MATCH_1
}
) # This is the actual matched variable, got to love CMake macro language
TARGET_LINK_LIBRARIES(libgit2_test
${
ZLIB_LIBRARY
}
${
LIB_SHA1
}
${
PTHREAD_LIBRARY
}
)
# Generate TOC by finding BEGIN_TEST entries in test source.
ADD_TEST(libgit2_test libgit2_test)
FILE(READ
${
TEST_SRC
}
TEST_CODE)
STRING(REGEX MATCHALL "
BEGIN_TEST\\
(
[^\\
)
]*\\
)
\n
" TEST_TOC
${
TEST_CODE
}
)
FILE(WRITE tests/
${
TEST_NAME
}
.toc
${
TEST_TOC
}
) # If desired this might be moved to the build dir
# Compile
ADD_EXECUTABLE(
${
TEST_NAME
}
tests/test_main.c tests/test_lib.c tests/test_helpers.c
${
TEST_SRC
}
)
TARGET_LINK_LIBRARIES(
${
TEST_NAME
}
git2)
SET_TARGET_PROPERTIES(
${
TEST_NAME
}
PROPERTIES COMPILE_DEFINITIONS TEST_TOC=
\"
${
TEST_NAME
}
.toc
\"
)
# Add CTest
ADD_TEST(
${
TEST_NAME
}
${
TEST_NAME
}
)
ENDFOREACH ()
ENDIF ()
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