Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

Commit

Permalink
Using CMAKE properties instead of variables for linking.
Browse files Browse the repository at this point in the history
  • Loading branch information
S-Dafarra committed Nov 5, 2018
1 parent 65c51f5 commit 4fb3834
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,11 @@ endif()
target_compile_options(${libraryname} PUBLIC ${COMPILER_OPTIONS})

# install
set_property(TARGET ${libraryname} PROPERTY PUBLIC_HEADER ${ALGLIB_HEADERS})
set_target_properties(${libraryname} PROPERTIES VERSION ${ALGLIB_VERSION}
PUBLIC_HEADER "${ALGLIB_HEADERS}")

target_include_directories(${libraryname} PUBLIC "$<BUILD_INTERFACE:${UNZIP_DIR}/cpp/src>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")

install(TARGETS ${libraryname}
EXPORT ${libraryname}
Expand Down
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,12 @@ Once the library is installed, you can link it using `CMake` with as little effo
...
find_package(ALGLIB REQUIRED)
...
target_link_libraries(<target> PRIVATE ${ALGLIB_LIB})
...
target_include_directories(<target> PRIVATE ${ALGLIB_INCLUDE_DIRS})
target_link_libraries(<target> PRIVATE ALGLIB)
...
```

Note that unless you did not use the default value of `CMAKE_INSTALL_PREFIX`, the `<prefix>` in which you installed iDynTree will need to be appended to the `CMAKE_PREFIX_PATH` enviromental
variable to ensure that `find_package` can find your iDynTree installation. Alternatively, you can specify the environmental variable
Note that unless you did not use the default value of `CMAKE_INSTALL_PREFIX`, the `<prefix>` in which you installed ALGLIB will need to be appended to the `CMAKE_PREFIX_PATH` enviromental
variable to ensure that `find_package` can find your ALGLIB installation. Alternatively, you can specify the environmental variable
```bash
export ALGLIB_DIR=path/where/alglib-cmake/is/installed
```
Expand Down
6 changes: 1 addition & 5 deletions cmake/ALGLIB-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@

# - Try to find alglib
# Once done this will define
# ALGLIB_INCLUDE_DIRS - The alglib include directory
# ALGLIB_LIB - The libraries needed to use alglib
# ALGLIB_FOUND - True if ALGLIB found.
# ALGLIB target

set(ALGLIB_VERSION @ALGLIB_VERSION@)
set(ALGLIB_FOUND TRUE)
Expand All @@ -19,6 +18,3 @@ set(ALGLIB_FOUND TRUE)
if(NOT TARGET ALGLIB)
include("${CMAKE_CURRENT_LIST_DIR}/ALGLIB.cmake")
endif()

set_and_check(ALGLIB_INCLUDE_DIRS "@CMAKE_INSTALL_FULL_INCLUDEDIR@" )
set(ALGLIB_LIB ALGLIB)

0 comments on commit 4fb3834

Please sign in to comment.