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
10b34e38
Commit
10b34e38
authored
Oct 28, 2014
by
Philip Quinn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CMake: Consistently quote variables that may contain special characters. Fixes #136.
parent
495319e0
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
46 additions
and
46 deletions
+46
-46
CMakeLists.txt
CMakeLists.txt
+1
-1
CMakeLists.txt
c++/src/CMakeLists.txt
+6
-6
CMakeLists.txt
c++/src/capnp/CMakeLists.txt
+12
-12
CMakeLists.txt
c++/src/kj/CMakeLists.txt
+5
-5
FindCapnProto.cmake
cmake/FindCapnProto.cmake
+22
-22
No files found.
CMakeLists.txt
View file @
10b34e38
project
(
"Cap'n Proto"
CXX
)
cmake_minimum_required
(
VERSION 2.8
)
set
(
CMAKE_MODULE_PATH
${
CMAKE_CURRENT_SOURCE_DIR
}
/cmake
)
set
(
CMAKE_MODULE_PATH
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/cmake"
)
include
(
CheckIncludeFileCXX
)
check_include_file_cxx
(
initializer_list HAS_CXX11
)
...
...
c++/src/CMakeLists.txt
View file @
10b34e38
include_directories
(
${
CMAKE_CURRENT_SOURCE_DIR
}
)
include_directories
(
"
${
CMAKE_CURRENT_SOURCE_DIR
}
"
)
# Tests ========================================================================
...
...
@@ -8,7 +8,7 @@ if(BUILD_TESTING)
# Setup CAPNP_GENERATE_CPP for compiling test schemas
find_package
(
CapnProto QUIET
)
set
(
CAPNP_INCLUDE_DIRS
${
CMAKE_CURRENT_SOURCE_DIR
}
)
set
(
CAPNP_INCLUDE_DIRS
"
${
CMAKE_CURRENT_SOURCE_DIR
}
"
)
# Setup googletest build and library targets (gtest and gtest_main)
include
(
ExternalProject
)
...
...
@@ -23,21 +23,21 @@ if(BUILD_TESTING)
add_library
(
gtest UNKNOWN IMPORTED
)
set_property
(
TARGET gtest
PROPERTY IMPORTED_LOCATION
${
binary_dir
}
/
${
CMAKE_FIND_LIBRARY_PREFIXES
}
gtest.a
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
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
)
include_directories
(
"
${
source_dir
}
/include"
)
# Sadly, we can't use the 'test' target, as that's coopted by ctest
add_custom_target
(
check
${
CMAKE_CTEST_COMMAND
}
-V
)
add_custom_target
(
check
"
${
CMAKE_CTEST_COMMAND
}
"
-V
)
endif
()
# BUILD_TESTING
# kj ===========================================================================
...
...
c++/src/capnp/CMakeLists.txt
View file @
10b34e38
...
...
@@ -76,8 +76,8 @@ set(capnp-rpc_headers
if
(
NOT CAPNP_LITE
)
add_library
(
capnp-rpc
${
capnp-rpc_sources
}
)
target_link_libraries
(
capnp-rpc kj-async kj
)
install
(
TARGETS capnp-rpc ARCHIVE DESTINATION
${
LIB_INSTALL_DIR
}
)
install
(
FILES
${
capnp-rpc_headers
}
DESTINATION
${
INCLUDE_INSTALL_DIR
}
/capnp
)
install
(
TARGETS capnp-rpc ARCHIVE DESTINATION
"
${
LIB_INSTALL_DIR
}
"
)
install
(
FILES
${
capnp-rpc_headers
}
DESTINATION
"
${
INCLUDE_INSTALL_DIR
}
/capnp"
)
endif
()
# Tools/Compilers ==============================================================
...
...
@@ -102,8 +102,8 @@ set(capnpc_headers
if
(
NOT CAPNP_LITE
)
add_library
(
capnpc
${
capnpc_sources
}
)
target_link_libraries
(
capnpc capnp kj
)
install
(
TARGETS capnpc ARCHIVE DESTINATION
${
LIB_INSTALL_DIR
}
)
install
(
FILES
${
capnpc_headers
}
DESTINATION
${
INCLUDE_INSTALL_DIR
}
/capnp
)
install
(
TARGETS capnpc ARCHIVE DESTINATION
"
${
LIB_INSTALL_DIR
}
"
)
install
(
FILES
${
capnpc_headers
}
DESTINATION
"
${
INCLUDE_INSTALL_DIR
}
/capnp"
)
endif
()
if
(
BUILD_TOOLS AND NOT CAPNP_LITE
)
...
...
@@ -129,7 +129,7 @@ if(BUILD_TOOLS AND NOT CAPNP_LITE)
install
(
TARGETS capnp_tool capnpc_cpp capnpc_capnp RUNTIME DESTINATION
"
${
BIN_INSTALL_DIR
}
"
)
# Symlink capnpc -> capnp
install
(
CODE
"execute_process(COMMAND
\"
${
CMAKE_COMMAND
}
\"
-E create_symlink capnp
${
BIN_INSTALL_DIR
}
/capnpc
)"
)
install
(
CODE
"execute_process(COMMAND
\"
${
CMAKE_COMMAND
}
\"
-E create_symlink capnp
\"
${
BIN_INSTALL_DIR
}
/capnpc
\"
)"
)
endif
()
# BUILD_TOOLS AND NOT CAPNP_LITE
# Tests ========================================================================
...
...
@@ -150,7 +150,7 @@ if(BUILD_TESTING)
# the FindCapnProto module; (2) environment variables; or (3) find_program()
if
(
NOT CAPNP_EXECUTABLE
)
if
(
DEFINED ENV{CAPNP}
)
set
(
CAPNP_EXECUTABLE
$ENV{CAPNP}
)
set
(
CAPNP_EXECUTABLE
"$ENV{CAPNP}"
)
else
()
find_program
(
CAPNP_EXECUTABLE capnp
)
endif
()
...
...
@@ -158,19 +158,19 @@ if(BUILD_TESTING)
if
(
NOT CAPNPC_CXX_EXECUTABLE
)
if
(
DEFINED ENV{CAPNPC_CXX}
)
set
(
CAPNPC_CXX_EXECUTABLE
$ENV{CAPNPC_CXX}
)
set
(
CAPNPC_CXX_EXECUTABLE
"$ENV{CAPNPC_CXX}"
)
else
()
# Also search in the same directory that `capnp` was found in
get_filename_component
(
capnp_dir
${
CAPNP_EXECUTABLE
}
DIRECTORY
)
find_program
(
CAPNPC_CXX_EXECUTABLE capnpc-c++ HINTS
${
capnp_dir
}
)
get_filename_component
(
capnp_dir
"
${
CAPNP_EXECUTABLE
}
"
DIRECTORY
)
find_program
(
CAPNPC_CXX_EXECUTABLE capnpc-c++ HINTS
"
${
capnp_dir
}
"
)
endif
()
endif
()
endif
()
# Add "/capnp" to match the path used to import the files in the test sources
set
(
CAPNPC_OUTPUT_DIR
${
CMAKE_CURRENT_BINARY_DIR
}
/test_capnp/capnp
)
include_directories
(
${
CMAKE_CURRENT_BINARY_DIR
}
/test_capnp
)
# Note: no "/capnp"
file
(
MAKE_DIRECTORY
${
CAPNPC_OUTPUT_DIR
}
)
set
(
CAPNPC_OUTPUT_DIR
"
${
CMAKE_CURRENT_BINARY_DIR
}
/test_capnp/capnp"
)
include_directories
(
"
${
CMAKE_CURRENT_BINARY_DIR
}
/test_capnp"
)
# Note: no "/capnp"
file
(
MAKE_DIRECTORY
"
${
CAPNPC_OUTPUT_DIR
}
"
)
capnp_generate_cpp
(
test_capnp_cpp_files test_capnp_h_files
${
test_capnp_files
}
)
...
...
c++/src/kj/CMakeLists.txt
View file @
10b34e38
...
...
@@ -46,9 +46,9 @@ set(kj-parse_headers
parse/char.h
)
add_library
(
kj
${
kj_sources
}
)
install
(
TARGETS kj ARCHIVE DESTINATION
${
LIB_INSTALL_DIR
}
)
install
(
FILES
${
kj_headers
}
DESTINATION
${
INCLUDE_INSTALL_DIR
}
/kj
)
install
(
FILES
${
kj-parse_headers
}
DESTINATION
${
INCLUDE_INSTALL_DIR
}
/kj/parse
)
install
(
TARGETS kj ARCHIVE DESTINATION
"
${
LIB_INSTALL_DIR
}
"
)
install
(
FILES
${
kj_headers
}
DESTINATION
"
${
INCLUDE_INSTALL_DIR
}
/kj"
)
install
(
FILES
${
kj-parse_headers
}
DESTINATION
"
${
INCLUDE_INSTALL_DIR
}
/kj/parse"
)
set
(
kj-async_sources
async.c++
...
...
@@ -65,8 +65,8 @@ set(kj-async_headers
if
(
NOT CAPNP_LITE
)
add_library
(
kj-async
${
kj-async_sources
}
)
target_link_libraries
(
kj-async kj
)
install
(
TARGETS kj-async ARCHIVE DESTINATION
${
LIB_INSTALL_DIR
}
)
install
(
FILES
${
kj-async_headers
}
DESTINATION
${
INCLUDE_INSTALL_DIR
}
/kj
)
install
(
TARGETS kj-async ARCHIVE DESTINATION
"
${
LIB_INSTALL_DIR
}
"
)
install
(
FILES
${
kj-async_headers
}
DESTINATION
"
${
INCLUDE_INSTALL_DIR
}
/kj"
)
endif
()
# Tests ========================================================================
...
...
cmake/FindCapnProto.cmake
View file @
10b34e38
...
...
@@ -67,7 +67,7 @@ function(CAPNP_GENERATE_CPP SOURCES HEADERS)
if
(
DEFINED CAPNPC_IMPORT_DIRS
)
# Append each directory as a series of '-I' flags in ${include_path}
foreach
(
directory
${
CAPNPC_IMPORT_DIRS
}
)
get_filename_component
(
absolute_path
${
directory
}
ABSOLUTE
)
get_filename_component
(
absolute_path
"
${
directory
}
"
ABSOLUTE
)
list
(
APPEND include_path -I
${
absolute_path
}
)
endforeach
()
endif
()
...
...
@@ -80,42 +80,42 @@ function(CAPNP_GENERATE_CPP SOURCES HEADERS)
endif
()
if
(
NOT DEFINED CAPNPC_SRC_PREFIX
)
set
(
CAPNPC_SRC_PREFIX
${
CMAKE_CURRENT_SOURCE_DIR
}
)
set
(
CAPNPC_SRC_PREFIX
"
${
CMAKE_CURRENT_SOURCE_DIR
}
"
)
endif
()
get_filename_component
(
CAPNPC_SRC_PREFIX
${
CAPNPC_SRC_PREFIX
}
ABSOLUTE
)
get_filename_component
(
CAPNPC_SRC_PREFIX
"
${
CAPNPC_SRC_PREFIX
}
"
ABSOLUTE
)
set
(
${
SOURCES
}
)
set
(
${
HEADERS
}
)
foreach
(
schema_file
${
ARGN
}
)
get_filename_component
(
file_path
${
schema_file
}
ABSOLUTE
)
get_filename_component
(
file_dir
${
file_path
}
PATH
)
get_filename_component
(
file_path
"
${
schema_file
}
"
ABSOLUTE
)
get_filename_component
(
file_dir
"
${
file_path
}
"
PATH
)
# Figure out where the output files will go
if
(
NOT DEFINED CAPNPC_OUTPUT_DIR
)
set
(
output_base
${
file_path
}
)
set
(
output_base
"
${
file_path
}
"
)
else
()
# Output files are placed in CAPNPC_OUTPUT_DIR, at a location as if they were
# relative to CAPNPC_SRC_PREFIX.
string
(
LENGTH
${
CAPNPC_SRC_PREFIX
}
prefix_len
)
string
(
SUBSTRING
${
file_path
}
0
${
prefix_len
}
output_prefix
)
if
(
NOT
${
CAPNPC_SRC_PREFIX
}
STREQUAL
${
output_prefix
}
)
string
(
LENGTH
"
${
CAPNPC_SRC_PREFIX
}
"
prefix_len
)
string
(
SUBSTRING
"
${
file_path
}
"
0
${
prefix_len
}
output_prefix
)
if
(
NOT
"
${
CAPNPC_SRC_PREFIX
}
"
STREQUAL
"
${
output_prefix
}
"
)
message
(
SEND_ERROR
"Could not determine output path for '
${
schema_file
}
' ('
${
file_path
}
') with source prefix '
${
CAPNPC_SRC_PREFIX
}
' into '
${
CAPNPC_OUTPUT_DIR
}
'."
)
endif
()
string
(
SUBSTRING
${
file_path
}
${
prefix_len
}
-1 output_path
)
set
(
output_base
${
CAPNPC_OUTPUT_DIR
}${
output_path
}
)
string
(
SUBSTRING
"
${
file_path
}
"
${
prefix_len
}
-1 output_path
)
set
(
output_base
"
${
CAPNPC_OUTPUT_DIR
}${
output_path
}
"
)
endif
()
add_custom_command
(
OUTPUT
"
${
output_base
}
.c++"
"
${
output_base
}
.h"
COMMAND
${
CAPNP_EXECUTABLE
}
COMMAND
"
${
CAPNP_EXECUTABLE
}
"
ARGS compile
-o
${
CAPNPC_CXX_EXECUTABLE
}${
output_dir
}
--src-prefix
${
CAPNPC_SRC_PREFIX
}
${
include_path
}
${
CAPNPC_FLAGS
}
${
file_path
}
DEPENDS
${
schema_file
}
DEPENDS
"
${
schema_file
}
"
COMMENT
"Compiling Cap'n Proto schema
${
schema_file
}
"
VERBATIM
)
...
...
@@ -136,16 +136,16 @@ pkg_check_modules(PKGCONFIG_CAPNP capnp)
pkg_check_modules
(
PKGCONFIG_CAPNP_RPC capnp-rpc QUIET
)
find_library
(
CAPNP_LIB_KJ kj
HINTS
${
PKGCONFIG_CAPNP_LIBDIR
}
${
PKGCONFIG_CAPNP_LIBRARY_DIRS
}
HINTS
"
${
PKGCONFIG_CAPNP_LIBDIR
}
"
${
PKGCONFIG_CAPNP_LIBRARY_DIRS
}
)
find_library
(
CAPNP_LIB_KJ-ASYNC kj-async
HINTS
${
PKGCONFIG_CAPNP_RPC_LIBDIR
}
${
PKGCONFIG_CAPNP_RPC_LIBRARY_DIRS
}
HINTS
"
${
PKGCONFIG_CAPNP_RPC_LIBDIR
}
"
${
PKGCONFIG_CAPNP_RPC_LIBRARY_DIRS
}
)
find_library
(
CAPNP_LIB_CAPNP capnp
HINTS
${
PKGCONFIG_CAPNP_LIBDIR
}
${
PKGCONFIG_CAPNP_LIBRARY_DIRS
}
HINTS
"
${
PKGCONFIG_CAPNP_LIBDIR
}
"
${
PKGCONFIG_CAPNP_LIBRARY_DIRS
}
)
find_library
(
CAPNP_LIB_CAPNP-RPC capnp-rpc
HINTS
${
PKGCONFIG_CAPNP_RPC_LIBDIR
}
${
PKGCONFIG_CAPNP_RPC_LIBRARY_DIRS
}
HINTS
"
${
PKGCONFIG_CAPNP_RPC_LIBDIR
}
"
${
PKGCONFIG_CAPNP_RPC_LIBRARY_DIRS
}
)
mark_as_advanced
(
CAPNP_LIB_KJ CAPNP_LIB_KJ-ASYNC CAPNP_LIB_CAPNP CAPNP_LIB_CAPNP-RPC
)
set
(
CAPNP_LIBRARIES_LITE
...
...
@@ -159,26 +159,26 @@ set(CAPNP_LIBRARIES
)
# Was only the 'lite' library found?
if
(
CAPNP_LIB_CAPNP
_FOUND AND NOT CAPNP_LIB_CAPNP-RPC_FOUND
)
set
(
CAPNP_DEFINITIONS
"-DCAPNP_LITE"
)
if
(
CAPNP_LIB_CAPNP
AND NOT CAPNP_LIB_CAPNP-RPC
)
set
(
CAPNP_DEFINITIONS
-DCAPNP_LITE
)
else
()
set
(
CAPNP_DEFINITIONS
)
endif
()
find_path
(
CAPNP_INCLUDE_DIRS capnp/generated-header-support.h
HINTS
${
PKGCONFIG_CAPNP_INCLUDEDIR
}
${
PKGCONFIG_CAPNP_INCLUDE_DIRS
}
HINTS
"
${
PKGCONFIG_CAPNP_INCLUDEDIR
}
"
${
PKGCONFIG_CAPNP_INCLUDE_DIRS
}
)
find_program
(
CAPNP_EXECUTABLE
NAMES capnp
DOC
"Cap'n Proto Command-line Tool"
HINTS
${
PKGCONFIG_CAPNP_PREFIX
}
/bin
HINTS
"
${
PKGCONFIG_CAPNP_PREFIX
}
/bin"
)
find_program
(
CAPNPC_CXX_EXECUTABLE
NAMES capnpc-c++
DOC
"Capn'n Proto C++ Compiler"
HINTS
${
PKGCONFIG_CAPNP_PREFIX
}
/bin
HINTS
"
${
PKGCONFIG_CAPNP_PREFIX
}
/bin"
)
# Only *require* the include directory, libkj, and libcapnp. If compiling with
...
...
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