elastix icon indicating copy to clipboard operation
elastix copied to clipboard

Missing cmake package config files

Open osemmler opened this issue 6 years ago • 1 comments

When building Elastix as library

cmake .. -DELASTIX_BUILD_EXECUTABLE:BOOL=OFF

CMake sucessfully generate files

ElastixConfig.cmake
ElastixConfigVersion.cmake
ElastixTargets.cmake

But when I try to install Elastix to install directory with

make install

these 3 files is not installed to CMAKE_INSTALL_PREFIX path.

osemmler avatar Jul 30 '18 11:07 osemmler

I slighlty modified the CMake files to include it into /install/lib/cmake

--- CMakeLists.txt	2020-06-08 10:12:16.601407707 +0200
+++ CMakeLists.txt	2020-06-08 10:31:20.967555368 +0200
@@ -566,3 +566,9 @@
 configure_file( ${CMAKE_SOURCE_DIR}/ElastixConfig.cmake.in ${CMAKE_BINARY_DIR}/ElastixConfig.cmake @ONLY )
 configure_file( ${CMAKE_SOURCE_DIR}/ElastixConfigVersion.cmake.in ${CMAKE_BINARY_DIR}/ElastixConfigVersion.cmake @ONLY )
 configure_file( ${CMAKE_SOURCE_DIR}/UseElastix.cmake.in ${CMAKE_BINARY_DIR}/UseElastix.cmake @ONLY )
+
+#add cmake to install
+install(FILES ${CMAKE_BINARY_DIR}/ElastixConfig.cmake DESTINATION ${ELASTIX_LIBRARY_DIR}/cmake/)
+install(FILES ${CMAKE_BINARY_DIR}/ElastixConfigVersion.cmake DESTINATION ${ELASTIX_LIBRARY_DIR}/cmake/)
+install(FILES ${CMAKE_BINARY_DIR}/UseElastix.cmake DESTINATION ${ELASTIX_LIBRARY_DIR}/cmake/)
+install(FILES ${CMAKE_BINARY_DIR}/ElastixTargets.cmake DESTINATION ${ELASTIX_LIBRARY_DIR}/cmake/)
--- ElastixConfig.cmake.in.bak	2020-06-10 11:20:05.619360726 +0200
+++ ElastixConfig.cmake.in	2020-06-10 11:21:54.951305733 +0200
@@ -1,4 +1,4 @@
-set( Elastix_DIR @PROJECT_BINARY_DIR@ )
+set( Elastix_DIR @CMAKE_INSTALL_PREFIX@/lib/cmake )
 
 # Add include directories needed to use SuperElastix
 set( ELASTIX_INCLUDE_DIRS @elxINCLUDE_DIRECTORIES@ )


okaerin avatar Jun 08 '20 08:06 okaerin

Thanks for reporting. As far as I can see, it is fixed by now, by https://github.com/SuperElastix/elastix/pull/655 (by @blowekamp).

Please reopen, if you think otherwise.

N-Dekker avatar Jan 13 '23 15:01 N-Dekker