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
2db5ef63
Commit
2db5ef63
authored
Nov 25, 2014
by
Philip Quinn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CMake: Update CMakeLists with MSVC compiler flags and paths.
parent
0f9a4777
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
28 deletions
+56
-28
CMakeLists.txt
CMakeLists.txt
+5
-1
CMakeLists.txt
c++/CMakeLists.txt
+38
-21
CMakeLists.txt
c++/src/CMakeLists.txt
+13
-6
No files found.
CMakeLists.txt
View file @
2db5ef63
...
...
@@ -4,7 +4,11 @@ cmake_minimum_required(VERSION 2.8)
set
(
CMAKE_MODULE_PATH
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/cmake"
)
include
(
CheckIncludeFileCXX
)
check_include_file_cxx
(
initializer_list HAS_CXX11
"-std=c++11"
)
if
(
MSVC
)
check_include_file_cxx
(
initializer_list HAS_CXX11
)
else
()
check_include_file_cxx
(
initializer_list HAS_CXX11
"-std=c++11"
)
endif
()
if
(
NOT HAS_CXX11
)
message
(
SEND_ERROR
"Requires a C++11 compiler and standard library."
)
endif
()
...
...
c++/CMakeLists.txt
View file @
2db5ef63
...
...
@@ -22,13 +22,28 @@ if(CAPNP_LITE AND BUILD_TOOLS)
message
(
WARNING
"Command-line tools will not be built with CAPNP_LITE."
)
endif
()
if
(
CAPNP_LITE
)
if
(
MSVC AND NOT CAPNP_LITE
)
message
(
SEND_ERROR
"Building with MSVC is only supported with CAPNP_LITE."
)
endif
()
if
(
CAPNP_LITE AND MSVC
)
set
(
CAPNP_LITE_FLAG
"/DCAPNP_LITE"
)
elseif
(
CAPNP_LITE
)
set
(
CAPNP_LITE_FLAG
"-DCAPNP_LITE"
)
else
()
set
(
CAPNP_LITE_FLAG
)
endif
()
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-Wall -Wextra -Wno-unused-parameter -std=c++11 -pthread
${
CAPNP_LITE_FLAG
}
"
)
if
(
MSVC
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
/Wall
${
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
()
# Source =======================================================================
...
...
@@ -36,25 +51,27 @@ add_subdirectory(src)
# Install ======================================================================
# Variables for pkg-config files
set
(
prefix
"
${
CMAKE_INSTALL_PREFIX
}
"
)
set
(
exec_prefix
"
${
EXEC_INSTALL_PREFIX
}
"
)
set
(
libdir
"
${
LIB_INSTALL_DIR
}
"
)
set
(
includedir
"
${
INCLUDE_INSTALL_DIR
}
"
)
set
(
PTHREAD_CFLAGS
"-pthread"
)
set
(
STDLIB_FLAG
)
# TODO: Unsupported
if
(
NOT MSVC
)
# Don't install pkg-config files when building with MSVC
# Variables for pkg-config files
set
(
prefix
"
${
CMAKE_INSTALL_PREFIX
}
"
)
set
(
exec_prefix
"
${
EXEC_INSTALL_PREFIX
}
"
)
set
(
libdir
"
${
LIB_INSTALL_DIR
}
"
)
set
(
includedir
"
${
INCLUDE_INSTALL_DIR
}
"
)
set
(
PTHREAD_CFLAGS
"-pthread"
)
set
(
STDLIB_FLAG
)
# TODO: Unsupported
configure_file
(
capnp.pc.in
"
${
CMAKE_CURRENT_BINARY_DIR
}
/capnp.pc"
@ONLY
)
install
(
FILES
"
${
CMAKE_CURRENT_BINARY_DIR
}
/capnp.pc"
DESTINATION
"
${
LIB_INSTALL_DIR
}
/pkgconfig"
)
configure_file
(
capnp.pc.in
"
${
CMAKE_CURRENT_BINARY_DIR
}
/capnp.pc"
@ONLY
)
install
(
FILES
"
${
CMAKE_CURRENT_BINARY_DIR
}
/capnp.pc"
DESTINATION
"
${
LIB_INSTALL_DIR
}
/pkgconfig"
)
if
(
NOT CAPNP_LITE
)
configure_file
(
capnp-rpc.pc.in
"
${
CMAKE_CURRENT_BINARY_DIR
}
/capnp-rpc.pc"
@ONLY
)
install
(
FILES
"
${
CMAKE_CURRENT_BINARY_DIR
}
/capnp-rpc.pc"
DESTINATION
"
${
LIB_INSTALL_DIR
}
/pkgconfig"
)
endif
()
if
(
NOT CAPNP_LITE
)
configure_file
(
capnp-rpc.pc.in
"
${
CMAKE_CURRENT_BINARY_DIR
}
/capnp-rpc.pc"
@ONLY
)
install
(
FILES
"
${
CMAKE_CURRENT_BINARY_DIR
}
/capnp-rpc.pc"
DESTINATION
"
${
LIB_INSTALL_DIR
}
/pkgconfig"
)
endif
()
unset
(
STDLIB_FLAG
)
unset
(
PTHREAD_CFLAGS
)
unset
(
includedir
)
unset
(
libdir
)
unset
(
exec_prefix
)
unset
(
prefix
)
unset
(
STDLIB_FLAG
)
unset
(
PTHREAD_CFLAGS
)
unset
(
includedir
)
unset
(
libdir
)
unset
(
exec_prefix
)
unset
(
prefix
)
endif
()
c++/src/CMakeLists.txt
View file @
2db5ef63
...
...
@@ -22,15 +22,22 @@ if(BUILD_TESTING)
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"
)
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"
)
else
()
set_target_properties
(
gtest PROPERTIES IMPORTED_LOCATION
"
${
binary_dir
}
/libgtest.a"
)
endif
()
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"
)
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"
)
else
()
set_target_properties
(
gtest_main PROPERTIES IMPORTED_LOCATION
"
${
binary_dir
}
/libgtest_main.a"
)
endif
()
add_dependencies
(
gtest_main gtest
)
ExternalProject_Get_Property
(
gtest_build source_dir
)
...
...
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