Skip to content

Commit 057bec0

Browse files
nim65sjorisv
authored andcommitted
CMake: updates for CMake >= 3.22
1 parent 0b10a13 commit 057bec0

File tree

6 files changed

+35
-49
lines changed

6 files changed

+35
-49
lines changed

CMakeLists.txt

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -86,22 +86,10 @@ include("${JRL_CMAKE_MODULES}/python.cmake")
8686
include("${JRL_CMAKE_MODULES}/boost.cmake")
8787
include("${JRL_CMAKE_MODULES}/ide.cmake")
8888
include("${JRL_CMAKE_MODULES}/apple.cmake")
89-
if(APPLE) # Use the handmade approach
90-
if(${CMAKE_VERSION} VERSION_LESS "3.18.0") # Need to find the right version
91-
set(CMAKE_MODULE_PATH ${JRL_CMAKE_MODULES}/find-external/OpenMP ${CMAKE_MODULE_PATH})
92-
endif()
93-
elseif(UNIX)
94-
if(${CMAKE_VERSION} VERSION_EQUAL "3.20.0")
95-
set(CMAKE_MODULE_PATH ${JRL_CMAKE_MODULES}/find-external/OpenMP ${CMAKE_MODULE_PATH})
96-
endif()
97-
endif()
9889
include(CMakeDependentOption)
9990

10091
# If needed, set CMake policy for APPLE systems
10192
apply_default_apple_configuration()
102-
if(CMAKE_VERSION VERSION_GREATER "3.12")
103-
cmake_policy(SET CMP0074 NEW)
104-
endif()
10593

10694
# Force C++ standard to be C++11 at least
10795
check_minimal_cxx_standard(11 ENFORCE)

unittest/packaging/cmake/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 2.6)
1+
cmake_minimum_required(VERSION 3.22)
22

33
project(ExtraLib CXX)
44

unittest/packaging/external/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.11)
1+
cmake_minimum_required(VERSION 3.22)
22

33
project(ExtraLib CXX)
44

unittest/packaging/pinocchio_header/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 2.6)
1+
cmake_minimum_required(VERSION 3.22)
22

33
project(ExtraLib CXX)
44
find_package(pinocchio REQUIRED)

unittest/packaging/pkgconfig/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.12)
1+
cmake_minimum_required(VERSION 3.22)
22

33
project(ExtraLib CXX)
44
find_package(PkgConfig REQUIRED)
Lines changed: 31 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,36 @@
1-
if(CMAKE_VERSION VERSION_GREATER 4.11)
2-
include(FetchContent)
3-
FetchContent_Declare(
4-
pybind11
5-
GIT_REPOSITORY https://github.com/pybind/pybind11
6-
GIT_TAG v2.10.0)
7-
FetchContent_GetProperties(pybind11)
8-
if(NOT pybind11_POPULATED)
9-
FetchContent_Populate(pybind11)
10-
add_subdirectory(${pybind11_SOURCE_DIR} ${pybind11_BINARY_DIR})
1+
include(FetchContent)
2+
FetchContent_Declare(
3+
pybind11
4+
GIT_REPOSITORY https://github.com/pybind/pybind11
5+
GIT_TAG v3.0.1)
6+
FetchContent_GetProperties(pybind11)
7+
if(NOT pybind11_POPULATED)
8+
FetchContent_Populate(pybind11)
9+
add_subdirectory(${pybind11_SOURCE_DIR} ${pybind11_BINARY_DIR})
1110

12-
# pybind11_add_module(cpp2pybind11 cpp2pybind11.cpp)
13-
#
14-
# BUG: might not work out of the box on OSX with conda:
15-
# https://github.com/pybind/pybind11/issues/3081
16-
if(NOT BUILD_TESTING)
17-
add_library(cpp2pybind11 MODULE EXCLUDE_FROM_ALL cpp2pybind11.cpp)
18-
else()
19-
add_library(cpp2pybind11 MODULE cpp2pybind11.cpp)
20-
endif()
21-
add_dependencies(build_tests cpp2pybind11)
22-
target_link_libraries(cpp2pybind11 PRIVATE pinocchio_pywrap_default pybind11::module)
23-
target_include_directories(cpp2pybind11 SYSTEM PUBLIC ${EIGEN3_INCLUDE_DIR})
24-
set_target_properties(cpp2pybind11 PROPERTIES PREFIX "" SUFFIX ${PYTHON_EXT_SUFFIX})
11+
# pybind11_add_module(cpp2pybind11 cpp2pybind11.cpp)
12+
#
13+
# BUG: might not work out of the box on OSX with conda:
14+
# https://github.com/pybind/pybind11/issues/3081
15+
if(NOT BUILD_TESTING)
16+
add_library(cpp2pybind11 MODULE EXCLUDE_FROM_ALL cpp2pybind11.cpp)
17+
else()
18+
add_library(cpp2pybind11 MODULE cpp2pybind11.cpp)
19+
endif()
20+
add_dependencies(build_tests cpp2pybind11)
21+
target_link_libraries(cpp2pybind11 PRIVATE pinocchio_pywrap_default pybind11::module
22+
Eigen3::Eigen)
23+
set_target_properties(cpp2pybind11 PROPERTIES PREFIX "" SUFFIX ${PYTHON_EXT_SUFFIX})
2524

26-
if(CMAKE_CXX_STANDARD LESS 14)
27-
message(STATUS "CXX_STANDARD for cpp2pybind11 changed from ${CMAKE_CXX_STANDARD} to 14")
28-
set_target_properties(cpp2pybind11 PROPERTIES CXX_STANDARD 14)
29-
endif()
25+
if(CMAKE_CXX_STANDARD LESS 14)
26+
message(STATUS "CXX_STANDARD for cpp2pybind11 changed from ${CMAKE_CXX_STANDARD} to 14")
27+
set_target_properties(cpp2pybind11 PROPERTIES CXX_STANDARD 14)
28+
endif()
3029

31-
if(WIN32)
32-
target_compile_definitions(cpp2pybind11 PRIVATE -DNOMINMAX)
33-
endif(WIN32)
30+
if(WIN32)
31+
target_compile_definitions(cpp2pybind11 PRIVATE -DNOMINMAX)
32+
endif(WIN32)
3433

35-
add_python_unit_test("test-py-cpp2pybind11" "unittest/python/pybind11/test-cpp2pybind11.py"
36-
"bindings/python" "unittest/python/pybind11")
37-
endif()
34+
add_python_unit_test("test-py-cpp2pybind11" "unittest/python/pybind11/test-cpp2pybind11.py"
35+
"bindings/python" "unittest/python/pybind11")
3836
endif()

0 commit comments

Comments
 (0)