Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
capnproto
Project
Project
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
capnproto
Commits
5cf9a211
Commit
5cf9a211
authored
Oct 18, 2014
by
Philip Quinn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use CMake's ExternalProject to fetch and build googletest.
parent
568d8e2c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
26 deletions
+29
-26
CMakeLists.txt
c++/CMakeLists.txt
+0
-9
setup-cmake.sh
c++/setup-cmake.sh
+0
-17
CMakeLists.txt
c++/src/CMakeLists.txt
+29
-0
No files found.
c++/CMakeLists.txt
View file @
5cf9a211
...
...
@@ -7,13 +7,4 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set
(
CMAKE_CXX_FLAGS
"-Wall -Wextra -Wno-unused-parameter -std=c++11"
)
if
(
EXISTS
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/gtest"
AND IS_DIRECTORY
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/gtest"
)
add_subdirectory
(
gtest
)
include_directories
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/gtest/include
)
else
()
message
(
FATAL_ERROR
"Please use setup-cmake.sh to download gtest before running the cmake build"
)
endif
()
include
(
CTest
)
add_subdirectory
(
src
)
c++/setup-cmake.sh
deleted
100755 → 0
View file @
568d8e2c
#! /usr/bin/env bash
set
-euo
pipefail
if
[
!
-e
gtest
]
;
then
echo
"================================================================================"
echo
"Fetching Google Test code..."
echo
"================================================================================"
svn checkout http://googletest.googlecode.com/svn/tags/release-1.7.0 gtest
fi
echo
"================================================================================"
echo
"Done"
echo
"================================================================================"
echo
echo
"Ready to run cmake (no support for installing yet). For example:"
echo
" mkdir build && cd build && cmake .. -G 'Unix Makefiles' && make -j6 check"
c++/src/CMakeLists.txt
View file @
5cf9a211
...
...
@@ -82,6 +82,34 @@ add_executable(capnpc_cpp
target_link_libraries
(
capnpc_cpp capnp kj
)
set_target_properties
(
capnpc_cpp PROPERTIES OUTPUT_NAME capnpc-c++
)
# Tests ==============================================================
# Setup googletest build and library targets (gtest and gtest_main)
include
(
ExternalProject
)
ExternalProject_Add
(
gtest_build
URL http://googletest.googlecode.com/files/gtest-1.7.0.zip
URL_HASH SHA1=f85f6d2481e2c6c4a18539e391aa4ea8ab0394af
CMAKE_ARGS -DCMAKE_BUILD_TYPE=
${
CMAKE_BUILD_TYPE
}
INSTALL_COMMAND
""
# Disable install
)
ExternalProject_Get_Property
(
gtest_build binary_dir
)
add_library
(
gtest UNKNOWN IMPORTED
)
set_property
(
TARGET gtest
PROPERTY IMPORTED_LOCATION
${
binary_dir
}
/
${
CMAKE_FIND_LIBRARY_PREFIXES
}
gtest.a
)
add_dependencies
(
gtest gtest_build
)
add_library
(
gtest_main UNKNOWN IMPORTED
)
set_property
(
TARGET gtest_main
PROPERTY IMPORTED_LOCATION
${
binary_dir
}
/
${
CMAKE_FIND_LIBRARY_PREFIXES
}
gtest_main.a
)
add_dependencies
(
gtest_main gtest
)
ExternalProject_Get_Property
(
gtest_build source_dir
)
include_directories
(
${
source_dir
}
/include
)
set
(
test_capnp_files
capnp/test.capnp
capnp/test-import.capnp
...
...
@@ -186,6 +214,7 @@ target_link_libraries(capnp-evolution-tests
gtest_main
)
include
(
CTest
)
add_test
(
NAME capnp-tests-run COMMAND capnp-tests
)
add_test
(
NAME capnp-evolution-tests-run COMMAND capnp-evolution-tests
)
...
...
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