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
9ec588a2
Commit
9ec588a2
authored
Dec 01, 2014
by
Philip Quinn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CMake: Simplify gtest library paths and use the default MSVC CRT flags.
parent
aa47edcc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
20 deletions
+18
-20
CMakeLists.txt
c++/CMakeLists.txt
+0
-5
CMakeLists.txt
c++/src/CMakeLists.txt
+18
-15
No files found.
c++/CMakeLists.txt
View file @
9ec588a2
...
...
@@ -34,11 +34,6 @@ endif()
if
(
MSVC
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
/W3
${
CAPNP_LITE_FLAG
}
"
)
# Statically link with the runtime libraries.
# TODO: This should depend on whether or not Cap'n Proto is being built as a static or shared library.
# When building the tests, this needs to match with how gtest is built as well.
set
(
CMAKE_CXX_FLAGS_DEBUG
"
${
CMAKE_CXX_FLAGS_DEBUG
}
/MTd"
)
set
(
CMAKE_CXX_FLAGS_RELEASE
"
${
CMAKE_CXX_FLAGS_RELEASE
}
/MT"
)
else
()
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-Wall -Wextra -Wno-unused-parameter -std=c++11 -pthread
${
CAPNP_LITE_FLAG
}
"
)
endif
()
...
...
c++/src/CMakeLists.txt
View file @
9ec588a2
...
...
@@ -15,34 +15,37 @@ if(BUILD_TESTING)
ExternalProject_Add
(
gtest_build
URL http://googletest.googlecode.com/files/gtest-1.7.0.zip
URL_MD5 2d6ec8ccdf5c46b05ba54a9fd1d130d7
CMAKE_ARGS -DCMAKE_BUILD_TYPE=
${
CMAKE_BUILD_TYPE
}
CMAKE_ARGS -DCMAKE_BUILD_TYPE=
${
CMAKE_BUILD_TYPE
}
-Dgtest_force_shared_crt=1
INSTALL_COMMAND
""
# Disable install
)
ExternalProject_Get_Property
(
gtest_build binary_dir
)
# Set platform-specific library prefix/extensions.
if
(
MSVC
)
set
(
gtest_prefix
)
set
(
gtest_suffix
".lib"
)
else
()
set
(
gtest_prefix
"lib"
)
set
(
gtest_suffix
".a"
)
endif
()
add_library
(
gtest UNKNOWN IMPORTED
)
if
(
CMAKE_GENERATOR MATCHES
"Visual Studio.*"
)
set_target_properties
(
gtest PROPERTIES IMPORTED_LOCATION_DEBUG
"
${
binary_dir
}
/Debug/gtest.lib"
)
set_target_properties
(
gtest PROPERTIES IMPORTED_LOCATION_RELEASE
"
${
binary_dir
}
/Release/gtest.lib"
)
elseif
(
CMAKE_GENERATOR STREQUAL Xcode
)
set_target_properties
(
gtest PROPERTIES IMPORTED_LOCATION_DEBUG
"
${
binary_dir
}
/Debug/libgtest.a"
)
set_target_properties
(
gtest PROPERTIES IMPORTED_LOCATION_RELEASE
"
${
binary_dir
}
/Release/libgtest.a"
)
if
(
CMAKE_GENERATOR MATCHES
"Visual Studio.*"
OR CMAKE_GENERATOR STREQUAL Xcode
)
set_target_properties
(
gtest PROPERTIES IMPORTED_LOCATION_DEBUG
"
${
binary_dir
}
/Debug/
${
gtest_prefix
}
gtest
${
gtest_suffix
}
"
)
set_target_properties
(
gtest PROPERTIES IMPORTED_LOCATION_RELEASE
"
${
binary_dir
}
/Release/
${
gtest_prefix
}
gtest
${
gtest_suffix
}
"
)
else
()
set_target_properties
(
gtest PROPERTIES IMPORTED_LOCATION
"
${
binary_dir
}
/
libgtest.a
"
)
set_target_properties
(
gtest PROPERTIES IMPORTED_LOCATION
"
${
binary_dir
}
/
${
gtest_prefix
}
gtest
${
gtest_suffix
}
"
)
endif
()
add_dependencies
(
gtest gtest_build
)
add_library
(
gtest_main UNKNOWN IMPORTED
)
if
(
CMAKE_GENERATOR MATCHES
"Visual Studio.*"
)
set_target_properties
(
gtest_main PROPERTIES IMPORTED_LOCATION_DEBUG
"
${
binary_dir
}
/Debug/gtest_main.lib"
)
set_target_properties
(
gtest_main PROPERTIES IMPORTED_LOCATION_RELEASE
"
${
binary_dir
}
/Release/gtest_main.lib"
)
elseif
(
CMAKE_GENERATOR STREQUAL Xcode
)
set_target_properties
(
gtest_main PROPERTIES IMPORTED_LOCATION_DEBUG
"
${
binary_dir
}
/Debug/libgtest_main.a"
)
set_target_properties
(
gtest_main PROPERTIES IMPORTED_LOCATION_RELEASE
"
${
binary_dir
}
/Release/libgtest_main.a"
)
if
(
CMAKE_GENERATOR MATCHES
"Visual Studio.*"
OR CMAKE_GENERATOR STREQUAL Xcode
)
set_target_properties
(
gtest_main PROPERTIES IMPORTED_LOCATION_DEBUG
"
${
binary_dir
}
/Debug/
${
gtest_prefix
}
gtest_main
${
gtest_suffix
}
"
)
set_target_properties
(
gtest_main PROPERTIES IMPORTED_LOCATION_RELEASE
"
${
binary_dir
}
/Release/
${
gtest_prefix
}
gtest_main
${
gtest_suffix
}
"
)
else
()
set_target_properties
(
gtest_main PROPERTIES IMPORTED_LOCATION
"
${
binary_dir
}
/
libgtest_main.a
"
)
set_target_properties
(
gtest_main PROPERTIES IMPORTED_LOCATION
"
${
binary_dir
}
/
${
gtest_prefix
}
gtest_main
${
gtest_suffix
}
"
)
endif
()
add_dependencies
(
gtest_main gtest
)
...
...
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