Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
yaml-cpp
Commits
e0b293e7
"src/node.cpp" did not exist on "c0c55fe50bee1b245cdfa06f1a4a849c14875b6c"
Commit
e0b293e7
authored
Mar 25, 2014
by
Jesse Beder
Browse files
Add test and util sources to make format
parent
a4a79835
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
6 deletions
+39
-6
CMakeLists.txt
CMakeLists.txt
+36
-6
test/CMakeLists.txt
test/CMakeLists.txt
+1
-0
util/CMakeLists.txt
util/CMakeLists.txt
+2
-0
No files found.
CMakeLists.txt
View file @
e0b293e7
...
@@ -54,6 +54,29 @@ option(MSVC_STHREADED_RT "MSVC: Build with single-threaded static runtime libs (
...
@@ -54,6 +54,29 @@ option(MSVC_STHREADED_RT "MSVC: Build with single-threaded static runtime libs (
###
###
### Sources, headers, directories and libs
### Sources, headers, directories and libs
###
###
# From http://www.cmake.org/pipermail/cmake/2010-March/035992.html:
# function to collect all the sources from sub-directories
# into a single list
function
(
add_sources
)
get_property
(
is_defined GLOBAL PROPERTY SRCS_LIST DEFINED
)
if
(
NOT is_defined
)
define_property
(
GLOBAL PROPERTY SRCS_LIST
BRIEF_DOCS
"List of source files"
FULL_DOCS
"List of all source files in the entire project"
)
endif
()
# make absolute paths
set
(
SRCS
)
foreach
(
s IN LISTS ARGN
)
if
(
NOT IS_ABSOLUTE
"
${
s
}
"
)
get_filename_component
(
s
"
${
s
}
"
ABSOLUTE
)
endif
()
list
(
APPEND SRCS
"
${
s
}
"
)
endforeach
()
# append to global list
set_property
(
GLOBAL APPEND PROPERTY SRCS_LIST
"
${
SRCS
}
"
)
endfunction
(
add_sources
)
set
(
header_directory
"include/yaml-cpp/"
)
set
(
header_directory
"include/yaml-cpp/"
)
file
(
GLOB sources
"src/[a-zA-Z]*.cpp"
)
file
(
GLOB sources
"src/[a-zA-Z]*.cpp"
)
...
@@ -68,7 +91,7 @@ else()
...
@@ -68,7 +91,7 @@ else()
add_definitions
(
-DYAML_CPP_NO_CONTRIB
)
add_definitions
(
-DYAML_CPP_NO_CONTRIB
)
endif
()
endif
()
set
(
all
_sources
set
(
library
_sources
${
sources
}
${
sources
}
${
public_headers
}
${
public_headers
}
${
private_headers
}
${
private_headers
}
...
@@ -76,6 +99,7 @@ set(all_sources
...
@@ -76,6 +99,7 @@ set(all_sources
${
contrib_public_headers
}
${
contrib_public_headers
}
${
contrib_private_headers
}
${
contrib_private_headers
}
)
)
add_sources
(
${
library_sources
}
)
if
(
VERBOSE
)
if
(
VERBOSE
)
message
(
STATUS
"sources:
${
sources
}
"
)
message
(
STATUS
"sources:
${
sources
}
"
)
...
@@ -162,10 +186,6 @@ if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" OR
...
@@ -162,10 +186,6 @@ if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" OR
COMMAND
${
CMAKE_COMMAND
}
-DCMAKE_BUILD_TYPE=Release
${
CMAKE_SOURCE_DIR
}
COMMAND
${
CMAKE_COMMAND
}
-DCMAKE_BUILD_TYPE=Release
${
CMAKE_SOURCE_DIR
}
COMMENT
"Adjusting settings for release compilation"
COMMENT
"Adjusting settings for release compilation"
VERBATIM
)
VERBATIM
)
add_custom_target
(
format
COMMAND clang-format --style=file -i
${
all_sources
}
COMMENT
"Running clang-format"
VERBATIM
)
endif
()
endif
()
endif
()
endif
()
...
@@ -246,7 +266,7 @@ set(_INSTALL_DESTINATIONS
...
@@ -246,7 +266,7 @@ set(_INSTALL_DESTINATIONS
###
###
### Library
### Library
###
###
add_library
(
yaml-cpp
${
all
_sources
}
)
add_library
(
yaml-cpp
${
library
_sources
}
)
set_target_properties
(
yaml-cpp PROPERTIES
set_target_properties
(
yaml-cpp PROPERTIES
COMPILE_FLAGS
"
${
yaml_c_flags
}
${
yaml_cxx_flags
}
"
COMPILE_FLAGS
"
${
yaml_c_flags
}
${
yaml_cxx_flags
}
"
)
)
...
@@ -296,3 +316,13 @@ if(YAML_CPP_BUILD_TOOLS)
...
@@ -296,3 +316,13 @@ if(YAML_CPP_BUILD_TOOLS)
add_subdirectory
(
test
)
add_subdirectory
(
test
)
add_subdirectory
(
util
)
add_subdirectory
(
util
)
endif
()
endif
()
### Formatting
if
(
${
CMAKE_BUILD_TOOL
}
MATCHES make OR
${
CMAKE_BUILD_TOOL
}
MATCHES gmake
)
get_property
(
all_sources GLOBAL PROPERTY SRCS_LIST
)
message
(
STATUS
${
all_sources
}
)
add_custom_target
(
format
COMMAND clang-format --style=file -i
${
all_sources
}
COMMENT
"Running clang-format"
VERBATIM
)
endif
()
\ No newline at end of file
test/CMakeLists.txt
View file @
e0b293e7
...
@@ -18,6 +18,7 @@ file(GLOB test_sources [a-z_]*.cpp integration/[a-z_]*.cpp)
...
@@ -18,6 +18,7 @@ file(GLOB test_sources [a-z_]*.cpp integration/[a-z_]*.cpp)
file
(
GLOB test_core_sources core/[a-z]*.cpp
)
file
(
GLOB test_core_sources core/[a-z]*.cpp
)
list
(
APPEND test_sources
${
test_core_sources
}
)
list
(
APPEND test_sources
${
test_core_sources
}
)
add_sources
(
${
test_sources
}
${
test_headers
}
)
include_directories
(
${
YAML_CPP_SOURCE_DIR
}
/test
)
include_directories
(
${
YAML_CPP_SOURCE_DIR
}
/test
)
...
...
util/CMakeLists.txt
View file @
e0b293e7
add_sources
(
sandbox.cpp
)
add_executable
(
sandbox sandbox.cpp
)
add_executable
(
sandbox sandbox.cpp
)
target_link_libraries
(
sandbox yaml-cpp
)
target_link_libraries
(
sandbox yaml-cpp
)
add_sources
(
read.cpp
)
add_executable
(
read read.cpp
)
add_executable
(
read read.cpp
)
target_link_libraries
(
read yaml-cpp
)
target_link_libraries
(
read yaml-cpp
)
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