Skip to content

Commit

Permalink
Use find_package for yaml-cpp, use C++14 by default (new boost wants it)
Browse files Browse the repository at this point in the history
  • Loading branch information
asherikov committed Nov 20, 2023
1 parent b4365b4 commit 28a1177
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 25 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ option (ARILES_VERBOSE "Verbose build" ON)
option (ARILES_BUILD_REGRESSION_TESTS "Build regression tests." ON)
option (ARILES_CCACHE "Enable ccache if available" ON)
set (ARILES_DEB_TARGETS "" CACHE STRING "Enable debian package generation.")
set (ARILES_CPP_STANDARD "14" CACHE STRING "14 is required for boost >= 1.82, 11 is still ok for ariles")

# install parameters
set (ARILES_PKGCONFIG_INSTALL_PATH "" CACHE STRING "pkg-config pc-file install path, not installed if empty")
Expand Down Expand Up @@ -209,7 +210,7 @@ set(CMAKEUT_CPP_SANITIZERS ${ARILES_CPP_SANITIZERS})
set(CMAKEUT_CLANG_TIDY ${ARILES_CPP_CLANG_TIDY})
set(CMAKEUT_CLANG_TIDY_EXTRA_IGNORES
"-cppcoreguidelines-special-member-functions,-hicpp-special-member-functions,-altera-struct-pack-align,-llvm-namespace-comment,-misc-no-recursion,-readability-const-return-type,-google-default-arguments,-bugprone-macro-parentheses,-cppcoreguidelines-pro-type-union-access,-hicpp-named-parameter,-readability-named-parameter,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-pro-type-union-access,-cppcoreguidelines-avoid-non-const-global-variables,-cert-err58-cpp,-cert-env33-c")
cmakeut_compiler_flags("c++11")
cmakeut_compiler_flags("c++${ARILES_CPP_STANDARD}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKEUT_CXX_FLAGS}")


Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,3 +263,5 @@ Related software
* Serialization libraries, e.g., `boost::serialization`,
https://github.com/USCiLab/cereal.

* A library with similar functionality in C++17
https://github.com/injae/serdepp.
19 changes: 1 addition & 18 deletions cmake/cmakeut_compiler_flags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -115,22 +115,5 @@ function(cmakeut_compiler_flags STANDARD)
set(CXX_GENERIC "-std=${STANDARD} ${CXX_WARNINGS} ${CXX_OTHER} ${CXX_SANITIZERS}")


if ("${STANDARD}" STREQUAL "c++11")

# -Wsuggest-override -Wsuggest-final-methods
set (CMAKEUT_CXX_FLAGS "${CXX_GENERIC}" PARENT_SCOPE)

elseif ("${STANDARD}" STREQUAL "c++03")

set (CMAKEUT_CXX_FLAGS "${CXX_GENERIC}" PARENT_SCOPE)

elseif ("${STANDARD}" STREQUAL "c++98")

set (CMAKEUT_CXX_FLAGS "${CXX_GENERIC}" PARENT_SCOPE)

else()

message(FATAL_ERROR "Unknown standard")

endif()
set (CMAKEUT_CXX_FLAGS "${CXX_GENERIC}" PARENT_SCOPE)
endfunction()
17 changes: 11 additions & 6 deletions extra_visitors/yaml_cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
set (TGT_ARILES_VISITOR_LIB "${PROJECT_NAME}_visitor_${ARILES_VISITOR}")

if(NOT ARILES_DEB_TARGETS)
pkg_search_module(${ARILES_VISITOR} REQUIRED yaml-cpp>=0.5.1)
find_package(yaml-cpp)

if(yaml-cpp_FOUND)
set(ARILES_VISITOR_${ARILES_VISITOR}_INCLUDES "${YAML_CPP_INCLUDE_DIR}")
set(ARILES_VISITOR_${ARILES_VISITOR}_LIBS "yaml-cpp")
else()
pkg_search_module(${ARILES_VISITOR} REQUIRED yaml-cpp>=0.5.1)

set(ARILES_VISITOR_${ARILES_VISITOR}_LIBRARY_DIRS "${${ARILES_VISITOR}_LIBRARY_DIRS}")
set(ARILES_VISITOR_${ARILES_VISITOR}_INCLUDES "${${ARILES_VISITOR}_INCLUDE_DIRS}")
set(ARILES_VISITOR_${ARILES_VISITOR}_LIBS "${${ARILES_VISITOR}_LIBRARIES}")
set(ARILES_VISITOR_${ARILES_VISITOR}_LIBRARY_DIRS "${${ARILES_VISITOR}_LIBRARY_DIRS}")
set(ARILES_VISITOR_${ARILES_VISITOR}_INCLUDES "${${ARILES_VISITOR}_INCLUDE_DIRS}")
set(ARILES_VISITOR_${ARILES_VISITOR}_LIBS "${${ARILES_VISITOR}_LIBRARIES}")


link_directories(${ARILES_VISITOR_${ARILES_VISITOR}_LIBRARY_DIRS})
link_directories(${ARILES_VISITOR_${ARILES_VISITOR}_LIBRARY_DIRS})
endif()
endif()

add_library(${TGT_ARILES_VISITOR_LIB}
Expand Down

0 comments on commit 28a1177

Please sign in to comment.