Skip to content

Commit

Permalink
Fix target name in old CMake versions
Browse files Browse the repository at this point in the history
  • Loading branch information
diegoferigo committed Sep 9, 2020
1 parent daf2eea commit f280b82
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions bindings/python/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
find_package(Python3 COMPONENTS Interpreter Development NumPy REQUIRED)
message(STATUS "Using Python: ${Python3_EXECUTABLE}")

cmake_policy(SET CMP0078 NEW)
cmake_policy(SET CMP0086 NEW)
if(${CMAKE_VERSION} VERSION_GREATER 3.14)
cmake_policy(SET CMP0078 NEW)
cmake_policy(SET CMP0086 NEW)
endif()

set_source_files_properties(../iDynTree.i PROPERTIES CPLUSPLUS ON)

Expand All @@ -13,6 +15,12 @@ swig_add_library(${target_name}
LANGUAGE python
SOURCES ../iDynTree.i)

# Override target name in old CMake version. It can be removed when the
# minimum CMake version is greater than 3.14.
if(${CMAKE_VERSION} VERSION_LESS 3.14)
set(target_name iDynTree ${SWIG_MODULE_iDynTree_python_REAL_NAME})
endif()

target_link_libraries(${target_name} PUBLIC Python3::Python Python3::NumPy)

set_target_properties(${target_name} PROPERTIES
Expand Down

0 comments on commit f280b82

Please sign in to comment.