Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
E
eigenpy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Guilhem Saurel
eigenpy
Commits
6b4d5f3b
Commit
6b4d5f3b
authored
2 years ago
by
Guilhem Saurel
Browse files
Options
Downloads
Patches
Plain Diff
cmake: relocatable package for recent CMake versions
parent
116c7c6b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
CMakeLists.txt
+36
-6
36 additions, 6 deletions
CMakeLists.txt
with
36 additions
and
6 deletions
CMakeLists.txt
+
36
−
6
View file @
6b4d5f3b
...
...
@@ -68,8 +68,23 @@ ELSE(WIN32)
SET
(
LINK create_symlink
)
ENDIF
(
WIN32
)
set
(
PYTHON_COMPONENTS Interpreter
)
if
(
CMAKE_VERSION VERSION_LESS
"3.18"
)
# Development.Module only require headers, so it's best for our module
# But it's not available before CMake 3.18
set
(
PYTHON_COMPONENTS
${
PYTHON_COMPONENTS
}
Development
)
else
()
set
(
PYTHON_COMPONENTS
${
PYTHON_COMPONENTS
}
Development.Module
)
endif
()
if
(
NOT CMAKE_VERSION VERSION_LESS
"3.14"
)
# NumPy provides a standard CMake imported target,
# But it's not available before CMake 3.14
set
(
PYTHON_COMPONENTS
${
PYTHON_COMPONENTS
}
NumPy
)
endif
()
FINDPYTHON
()
FIND_NUMPY
()
if
(
CMAKE_VERSION VERSION_LESS
"3.14"
)
FIND_NUMPY
()
endif
()
IF
(
WIN32
)
LINK_DIRECTORIES
(
${
PYTHON_LIBRARY_DIRS
}
)
...
...
@@ -200,13 +215,23 @@ SET(${PROJECT_NAME}_SOURCES
ADD_LIBRARY
(
${
PROJECT_NAME
}
SHARED
${${
PROJECT_NAME
}
_SOURCES
}
${${
PROJECT_NAME
}
_HEADERS
}
)
TARGET_INCLUDE_DIRECTORIES
(
${
PROJECT_NAME
}
SYSTEM PUBLIC
${
Boost_INCLUDE_DIRS
}
${
EIGEN3_INCLUDE_DIR
}
${
PYTHON_INCLUDE_DIRS
}
${
NUMPY_INCLUDE_DIRS
}
$<BUILD_INTERFACE:
${
CMAKE_CURRENT_BINARY_DIR
}
/include>
$<INSTALL_INTERFACE:include>
)
if
(
TARGET Eigen3::Eigen
)
TARGET_LINK_LIBRARIES
(
${
PROJECT_NAME
}
PUBLIC Eigen3::Eigen
)
else
()
TARGET_INCLUDE_DIRECTORIES
(
${
PROJECT_NAME
}
SYSTEM PUBLIC
${
EIGEN3_INCLUDE_DIR
}
)
endif
()
if
(
TARGET Python3::NumPy
)
TARGET_LINK_LIBRARIES
(
${
PROJECT_NAME
}
PUBLIC Python3::NumPy
)
TARGET_INCLUDE_DIRECTORIES
(
${
PROJECT_NAME
}
SYSTEM PRIVATE
${
Python3_INCLUDE_DIRS
}
)
else
()
TARGET_INCLUDE_DIRECTORIES
(
${
PROJECT_NAME
}
SYSTEM PUBLIC
${
NUMPY_INCLUDE_DIRS
}
)
TARGET_INCLUDE_DIRECTORIES
(
${
PROJECT_NAME
}
SYSTEM PRIVATE
${
PYTHON_INCLUDE_DIRS
}
)
endif
()
IF
(
SUFFIX_SO_VERSION
)
SET_TARGET_PROPERTIES
(
${
PROJECT_NAME
}
PROPERTIES SOVERSION
${
PROJECT_VERSION
}
)
ENDIF
(
SUFFIX_SO_VERSION
)
...
...
@@ -217,7 +242,12 @@ ELSE()
TARGET_COMPILE_OPTIONS
(
${
PROJECT_NAME
}
PRIVATE $<$<CXX_COMPILER_ID:MSVC>:-bigobj>
)
ENDIF
()
TARGET_LINK_BOOST_PYTHON
(
${
PROJECT_NAME
}
PUBLIC
)
if
(
TARGET Boost::python3
${
Python3_VERSION_MINOR
}
AND NOT APPLE
)
TARGET_LINK_LIBRARIES
(
${
PROJECT_NAME
}
PUBLIC Boost::python3
${
Python3_VERSION_MINOR
}
)
else
()
TARGET_LINK_BOOST_PYTHON
(
${
PROJECT_NAME
}
PUBLIC
)
TARGET_INCLUDE_DIRECTORIES
(
${
PROJECT_NAME
}
SYSTEM PUBLIC
${
Boost_INCLUDE_DIRS
}
)
endif
()
INSTALL
(
TARGETS
${
PROJECT_NAME
}
EXPORT
${
TARGETS_EXPORT_NAME
}
PUBLIC_HEADER DESTINATION
${
CMAKE_INSTALL_FULL_INCLUDEDIR
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment