CMake config: Set minimum C++ version needed in a different way
This setting should be overwritten if CMake find that some library needs an even more modern version.
This commit is contained in:
parent
4e009b0055
commit
30097cd4cb
|
|
@ -68,7 +68,7 @@ jobs:
|
||||||
env:
|
env:
|
||||||
CC: clang
|
CC: clang
|
||||||
CXX: clang++
|
CXX: clang++
|
||||||
CXXFLAGS: -Werror -Wall -pedantic -std=c++17
|
CXXFLAGS: -Werror -Wall -pedantic
|
||||||
BUILD_TYPE: Debug
|
BUILD_TYPE: Debug
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,14 @@ project(osmpbf VERSION 1.5.0)
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
|
# This is needed for the protobuf_generate_cpp() function to work on newer
|
||||||
|
# versions of the Protobuf CMake config.
|
||||||
|
set(protobuf_MODULE_COMPATIBLE ON CACHE BOOL "")
|
||||||
|
|
||||||
|
# This is needed so that we pick up the (more modern) CONFIG mode cmake file
|
||||||
|
# before the (older) MODULE mode cmake config file. Seems to be needed on macOS.
|
||||||
|
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG TRUE)
|
||||||
|
|
||||||
find_package(Protobuf REQUIRED)
|
find_package(Protobuf REQUIRED)
|
||||||
|
|
||||||
add_subdirectory(osmpbf)
|
add_subdirectory(osmpbf)
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,13 @@
|
||||||
protobuf_generate_cpp(CPPS HS fileformat.proto osmformat.proto)
|
protobuf_generate_cpp(CPPS HS fileformat.proto osmformat.proto)
|
||||||
|
|
||||||
add_library(osmpbf STATIC ${CPPS})
|
add_library(osmpbf STATIC ${CPPS})
|
||||||
|
target_compile_features(osmpbf PUBLIC cxx_std_11)
|
||||||
|
target_link_libraries(osmpbf PRIVATE protobuf::libprotobuf)
|
||||||
target_include_directories(osmpbf SYSTEM PUBLIC ${Protobuf_INCLUDE_DIRS})
|
target_include_directories(osmpbf SYSTEM PUBLIC ${Protobuf_INCLUDE_DIRS})
|
||||||
set_property(TARGET osmpbf PROPERTY CXX_STANDARD 11)
|
|
||||||
install(TARGETS osmpbf ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
install(TARGETS osmpbf ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
|
|
||||||
add_library(osmpbf_shared SHARED ${CPPS})
|
add_library(osmpbf_shared SHARED ${CPPS})
|
||||||
set_property(TARGET osmpbf_shared PROPERTY CXX_STANDARD 11)
|
target_compile_features(osmpbf_shared PUBLIC cxx_std_11)
|
||||||
target_link_libraries(osmpbf_shared PRIVATE protobuf::libprotobuf)
|
target_link_libraries(osmpbf_shared PRIVATE protobuf::libprotobuf)
|
||||||
target_include_directories(osmpbf_shared SYSTEM PUBLIC ${Protobuf_INCLUDE_DIRS})
|
target_include_directories(osmpbf_shared SYSTEM PUBLIC ${Protobuf_INCLUDE_DIRS})
|
||||||
set_target_properties(osmpbf_shared PROPERTIES OUTPUT_NAME osmpbf
|
set_target_properties(osmpbf_shared PROPERTIES OUTPUT_NAME osmpbf
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue