# Third party shared LIB file placement in a custom Slicer application

**URL:** <https://discourse.slicer.org/t/third-party-shared-lib-file-placement-in-a-custom-slicer-application/44203>\
**Category:** Development\
**Created:** [August 25, 2025, 9:16pm UTC](https://discourse.slicer.org/t/third-party-shared-lib-file-placement-in-a-custom-slicer-application/44203 "2025-08-25T21:16:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ejm-revvity](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ejm-revvity/32/80123_2.png) [@ejm-revvity](https://discourse.slicer.org/u/ejm-revvity)\
**Post date:** [August 25, 2025, 9:16pm UTC](https://discourse.slicer.org/t/third-party-shared-lib-file-placement-in-a-custom-slicer-application/44203/1 "2025-08-25T21:16:27Z")

</div>

I’m adding in license management functionality to our custom Slicer application. We’re using Revanera FlexNet which provides a sort of SDK in the form of include (.h) files, .lib files and runtime .dll files.

I can successfully build/link/run the application IFF I place all source, includes, LIB files in the top-level project directory and make minor changes to CMakeLists.txt to add all the relevant source files to APPLIB\_SRCS.

However, when I create a logical directory structure and place all the required files in their respective places, along with creating the associated CMakeLists.txt files, I can successfully build the application, but the linker reports a series of unresolved symbols. I have verified that the symbols exist in the relevant .lib files (and of course they do since I can link successfully in the ‘single directory’ case), so the conclusion I must draw is that the build system is not finding the required .lib files.

Where should they be placed?

Here is the folder structure and relevant part of the top-level CMakeLists.txt file:

```plaintext
XXXApp/ 
├── CMakeLists.txt # Top-level; single executable output
├── LicenseManager/ # LicenseManagerXXX source and includes; no lib input or output
│ └── CMakeLists.txt
│ └── FlexNet/ # FlexNetXXX source and includes; no lib input or output 
│ └── CMakeLists.txt 
│ └── Flc/ # Flc includes for third party library 
│ └── CMakeLists.txt 
│ └── Lib/ # Flc imported library .lib and .dll files 
│ └── CMakeLists.txt (not necessary because not building from source)

```

```bash
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/LicenseManager/FlexNet/Lib/FlxClientXT.lib")
  file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/LicenseManager/FlexNet/Lib/FlxClientXT.lib" DESTINATION ${CMAKE_BINARY_DIR})
endif()

if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/LicenseManager/FlexNet/Lib/FlxCommonXT.lib")
  file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/LicenseManager/FlexNet/Lib/FlxCommonXT.lib" DESTINATION ${CMAKE_BINARY_DIR})
endif()

set(APPLIB_NAME ${APPLIB_NAME} CACHE INTERNAL "Main application library")

add_library(FlxClientXT SHARED IMPORTED)
set_target_properties(FlxClientXT PROPERTIES
  IMPORTED_IMPLIB "${CMAKE_BINARY_DIR}/FlxClientXT.lib"
  IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/LicenseManager/FlexNet/Lib/FlxCore64.dll"
)

add_library(FlxCommonXT SHARED IMPORTED)
set_target_properties(FlxCommonXT PROPERTIES
  IMPORTED_IMPLIB "${CMAKE_BINARY_DIR}/FlxCommonXT.lib"
  IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/LicenseManager/FlexNet/Lib/FlxComm64.dll"
)

add_subdirectory(LicenseManager)
add_subdirectory(LicenseManager/FlexNet)
add_subdirectory(LicenseManager/FlexNet/Flc)

target_include_directories(${APP_TARGET_NAME}
    PRIVATE
        LicenseManager/FlexNet
        LicenseManager/FlexNet/Flc
)

target_link_libraries(${APP_TARGET_NAME}
    ${APPLIB_NAME}
        FlxClientXT
        FlxCommonXT
        legacy_stdio_definitions
)

```
