qRestAPI icon indicating copy to clipboard operation
qRestAPI copied to clipboard

ENH: Refactor CMake project infrastructure

Open RafaelPalomar opened this issue 1 year ago • 0 comments

This PR updates the cmake project definition for qRestAPI:

  • Removed old configuration and use CMake files in favor ofqRestAPIConfig.cmake.in
  • Enable install configuration through implementation of qRestAPIInstallConfig.cmake.in
  • Enabled installation of development files (optional).

This PR has been greatly inspired on the project definition for vtkAddon project. The motivation for this PR is to enable this library as a standalone library that can be installed and used in other projects and will be useful to build 3D Sclier with SUPERBUILD=OFF and support the SystoleOS.

Since these changes affect the cmake configuration files (most notably removing the need for UseqRestAPI.cmake file), projects using the library will need to update their cmake project definitions.

Installation examples

Library installation

cmake -S . -B build
❯ make install
[ 65%] Built target qRestAPI
[100%] Built target qRestAPITests
Install the project...
-- Install configuration: ""
-- Installing: /tmp/test-prefix/lib/qRestAPI/libqRestAPI.so
-- Installing: /tmp/test-prefix/cmake/qRestAPI/qRestAPIConfig.cmake

Library and development files installation

cmake -S . -B build -DqRestAPI_INSTALL_NO_DEVELOPMENT=OFF
❯ make install
[ 65%] Built target qRestAPI
[100%] Built target qRestAPITests
Install the project...
-- Install configuration: ""
-- Installing: /tmp/test-prefix/include/qRestAPI/qGirderAPI.h
-- Installing: /tmp/test-prefix/include/qRestAPI/qMidasAPI.h
-- Installing: /tmp/test-prefix/include/qRestAPI/qRestAPI.h
-- Installing: /tmp/test-prefix/include/qRestAPI/qRestAPI_p.h
-- Installing: /tmp/test-prefix/include/qRestAPI/qRestResult.h
-- Installing: /tmp/test-prefix/include/qRestAPI/qRestAPI_Export.h
-- Up-to-date: /tmp/test-prefix/lib/qRestAPI/libqRestAPI.so
-- Installing: /tmp/test-prefix/cmake/qRestAPI/qRestAPIConfig.cmake

content of install configuration:

❯ cat /tmp/test-prefix/cmake/qRestAPI/qRestAPIConfig.cmake
set(qRestAPI_CMAKE_DIR "/tmp/test-prefix/cmake/qRestAPI")
set(qRestAPI_INCLUDE_DIRS "/tmp/test-prefix/include/qRestAPI")
set(qRestAPI_LIB_DIR "/tmp/test-prefix/lib/qRestAPI")

RafaelPalomar avatar Jan 13 '24 12:01 RafaelPalomar