Hi,
I wanted some support on adding a library in my custom loadable module.
This is my cmake for adding a library called “SystemChecker” which is inside a directory called “SystemCheck”.
The library is building correctly as the subdirectory’s cmake is working fine.
When I try to link the built library with the loadable module I am getting this error.
CMake Error in CMakeLists.txt:
export called with target "vtkSlicerplanManagerModuleLogic" which requires
target "SystemChecker" that is not in any export set.
planManager is the name of my extension, it’s cmake is :-
project(vtkSlicer${MODULE_NAME}ModuleLogic)
find_package(wxWidgets REQUIRED)
find_package(OpenSSL REQUIRED)
include(${wxWidgets_USE_FILE})
add_subdirectory(SystemCheck)
set(KIT ${PROJECT_NAME})
set(${KIT}_EXPORT_DIRECTIVE "VTK_SLICER_${MODULE_NAME_UPPER}_MODULE_LOGIC_EXPORT")
set(${KIT}_INCLUDE_DIRECTORIES
${PYTHON_INCLUDE_DIRS}
)
set(${KIT}_SRCS
vtkSlicer${MODULE_NAME}Logic.cxx
vtkSlicer${MODULE_NAME}Logic.h
)
set(${KIT}_TARGET_LIBRARIES
${PYTHON_LIBRARIES}
${ITK_LIBRARIES}
SystemChecker
)
#-----------------------------------------------------------------------------
SlicerMacroBuildModuleLogic(
NAME ${KIT}
EXPORT_DIRECTIVE ${${KIT}_EXPORT_DIRECTIVE}
INCLUDE_DIRECTORIES ${${KIT}_INCLUDE_DIRECTORIES}
SRCS ${${KIT}_SRCS}
TARGET_LIBRARIES ${${KIT}_TARGET_LIBRARIES}
)
Further the directory SystemCheck has another Cmake file :-
cmake_minimum_required(VERSION 3.10)
add_library(SystemChecker STATIC
src/MACAddressUtility.cpp
src/sha.cpp
src/isValidMachine.cpp
)
target_include_directories(
SystemChecker
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/include
${OPENSSL_INCLUDE_DIR}
${wxWidgets_INCLUDE_DIRS}
)
target_link_libraries(
SystemChecker
PUBLIC
${wxWidgets_LIBRARIES}
${OPENSSL_LIBRARIES}
)
I realize this issue is due to a lack of good knowledge in Cmake, but I am having doubts on using Cmake with the slicer macros.