[SOLVED] .lib file of external module is not build

Thanks for the link to you project, looking good! And great initiative to create an External Module.

So, just for clarification ENABLE_SHARED in the itk-module.cmake allows ‘listening’ to the BUILD_SHARED_LIBS. but if BUILD_SHARED_LIBS is OFF, no shared libraries will be generated.

I am not a Windows user, but googling a little bit about the missing .lib, but the .dll being there: https://stackoverflow.com/questions/7614286/how-do-i-get-cmake-to-create-a-dll-and-its-matching-lib-file

There is a cmake post about it: https://blog.kitware.com/create-dlls-on-windows-without-declspec-using-new-cmake-export-all-feature/

And a related change in ITK classes in this review: http://review.source.kitware.com/#/c/20020

This is beyond my knowledge to make any advice with confident and I have no windows machine at hand right now to test. But you might try:

template<class TFixedImage, class TMovingImage, class TGradientPixelType>
class ORA_EXPORT GradientDifferenceImageToImageMetric :
    public itk::ImageToImageMetric<TFixedImage, TMovingImage>

and compile with the CMake option: CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS:BOOL=ON

It is a long shot, maybe somebody can suggest the best approach. Tricky stuff.

By the way, with BUILD_SHARED_LIBS:BOOL=OFF, does it work?