libfort icon indicating copy to clipboard operation
libfort copied to clipboard

CMake build does not generate .lib

Open rshamsnejad opened this issue 4 years ago • 1 comments

Hi,

I am trying to integrate libfort as part of a project built using CMake. I would like to link to it either statically by using a .lib file, or dynamically but with exports linked through a .lib file also.

I can't figure out how to build libfort one way or the other using CMake. All I've managed is to generate a .dll file alone.

Any pointers ?

Thanks !

rshamsnejad avatar Dec 03 '21 16:12 rshamsnejad

Here's a workaround I found :

# Workaround to force symbol export
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)

include(FetchContent)
FetchContent_Declare(libfort
  GIT_REPOSITORY    https://github.com/seleznevae/libfort.git
  GIT_TAG           v0.4.2
  STEP_TARGETS      build
)

FetchContent_MakeAvailable(libfort)

# Workaround to force symbol export
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS FALSE)

But I think it would be better to have dllexport directives in the source code directly.

rshamsnejad avatar Dec 20 '21 10:12 rshamsnejad