Skip to content

Commit

Permalink
build: downgrade cmake version to 3.11.4
Browse files Browse the repository at this point in the history
Signed-off-by: black-desk <me@black-desk.cn>
  • Loading branch information
black-desk committed Apr 2, 2024
1 parent 7e3c5ea commit d329a09
Show file tree
Hide file tree
Showing 6 changed files with 131 additions and 102 deletions.
25 changes: 19 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.14..3.28.3)
cmake_minimum_required(VERSION 3.11.4)

project(
ocppi
Expand All @@ -7,7 +7,24 @@ project(

option(OCPPI_WITH_SPDLOG "Build ocppi with spdlog or not." OFF)

include(./cmake/CPM.cmake)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
include(PFL)
if(CMAKE_VERSION VERSION_LESS "3.14")
message(
STATUS "cmake version ${CMAKE_VERSION} not compatible with CPM.cmake, "
"CPMFindPackage fallback to simply find_package.")
# Only function we used in CPM.cmake is CPMFindPackage
function(CPMFindPackage)
cmake_parse_arguments(CPMFindPackage ""
"NAME;VERSION;FIND_PACKAGE_ARGUMENTS" "" ${ARGN})
string(REPLACE " " ";" EXTRA_ARGS
"${CPMFindPackage_FIND_PACKAGE_ARGUMENTS}")
find_package(${CPMFindPackage_NAME} ${CPMFindPackage_VERSION} ${EXTRA_ARGS}
REQUIRED)
endfunction()
else()
include(CPM)
endif()

set(OCPPI_TL_EXPECTED_VERSION 1.0.0) # debian buster-backports
CPMFindPackage(
Expand Down Expand Up @@ -64,10 +81,6 @@ gitsemver(OCPPI_SEMVER)

set(OCPPI_OCI_RUNTIME_SPEC_MIN "1.0.0")
set(OCPPI_OCI_RUNTIME_SPEC_MAX "1.1.0")
set(OCPPI_LIBRARY_TYPE "STATIC")
if(OCPPI_BUILD_SHARED_LIBRARY)
set(OCPPI_LIBRARY_TYPE "SHARED")
endif()

include(./cmake/PFL.cmake)

Expand Down
4 changes: 2 additions & 2 deletions cmake/GitSemver.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function(gitsemver_message)
message(STATUS "GitSemver: " ${ARGN})
endfunction()

message(STATUS "GitSemver: --==Version: v0.1.2==--")
message(STATUS "GitSemver: --==Version: v0.1.3==--")

# GitSemver will write the result to varname if it successfully get version
# string from git repository.
Expand Down Expand Up @@ -45,7 +45,7 @@ function(GitSemver varname)
COMMAND ${SED_EXECUTABLE} -e s/^v//
COMMAND ${SED_EXECUTABLE} -e s/+\$//
OUTPUT_VARIABLE ${varname} RESULTS_VARIABLE rets
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET COMMAND_ECHO STDOUT)
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)

foreach(ret ${rets})
if(NOT ret EQUAL 0)
Expand Down
Loading

0 comments on commit d329a09

Please sign in to comment.