[ITK-users] Linking an external ITK module against LAPACK?

DVigneault davis.vigneault at gmail.com
Wed Apr 13 19:16:56 EDT 2016


All--

I have an external ITK module ITK/src/Modules/External/ITKDVUtilities/. 
Additionally, I have written a group of classes which depend on VNL and
LAPACK (subroutines which do not ship with VNL).  I've tested them in a
project outside the ITK source tree linking against LAPACK.  I'd now like to
use these classes in my ITK module, but am unclear on how to link my module
against LAPACK.  Adding target_link_libraries(${itk-module}
${LAPACK-LIBRARIES}) to ITKDVUtilities/CMakeLists.txt gives me the following
CMake configuration error:

CMake Error at Modules/External/ITKDVUtilities/CMakeLists.txt:15
(target_link_libraries):
   Cannot specify link libraries for target "ITKDVUtilities" which is not
   built by this project.

But, of course, if I leave it out, I get a linker error:

Undefined symbols for architecture x86_64:
  "_dgees_", referenced from:
      vnl_schur_decomposition<double>::solve() in
ITKDVUtilitiesHeaderTest1.cxx.o
  "_sgees_", referenced from:
      vnl_schur_decomposition<float>::solve() in
ITKDVUtilitiesHeaderTest1.cxx.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
make[2]: *** [bin/ITKDVUtilitiesHeaderTest1] Error 1
make[1]: ***
[Modules/External/ITKDVUtilities/CMakeFiles/ITKDVUtilitiesHeaderTest1.dir/all]
Error 2
make: *** [all] Error 2

I've pasted below the full text of
ITK/srs/Modules/External/ITKDVUtilities/CMakeLists.txt.  Thanks very much in
advance for your help!

Best,

--Davis

# ITK/srs/Modules/External/ITKDVUtilities/CMakeLists.txt
cmake_minimum_required(VERSION 2.8.9)

project(ITKDVUtilities)

find_package(LAPACK REQUIRED)

if(NOT ITK_SOURCE_DIR)
  find_package(ITK REQUIRED)
  list(APPEND CMAKE_MODULE_PATH ${ITK_CMAKE_DIR})
  include(ITKModuleExternal)
else()
  itk_module_impl()
endif()

#target_link_libraries(${itk-module} ${LAPACK-LIBRARIES})



--
View this message in context: http://itk-insight-users.2283740.n2.nabble.com/Linking-an-external-ITK-module-against-LAPACK-tp7588734.html
Sent from the ITK Insight Users mailing list archive at Nabble.com.


More information about the Insight-users mailing list