Skip to content

Commit

Permalink
Dynamically choose the library directory based on the type of tool chain
Browse files Browse the repository at this point in the history
  • Loading branch information
vijaiaeroastro authored and gangatp committed Apr 15, 2024
1 parent 7597c67 commit f96fc53
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions cmake/lib3mfConfig.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# lib3mfConfig.cmake

if(VCPKG_TOOLCHAIN)
message("Lib3MF - VCPKG Tool Chain")
set(LIB3MF_ROOT_DIR "${CMAKE_CURRENT_LIST_DIR}/../..")
else()
message("Lib3MF - General CMake Tool Chain")
set(LIB3MF_ROOT_DIR "${CMAKE_CURRENT_LIST_DIR}/../../..")
endif()


# Initial setup for known components and default selection
set(lib3mf_known_components "C" "CDynamic" "Cpp" "CppDynamic")
set(lib3mf_selected_variant "Cpp") # Default variant
Expand All @@ -13,9 +22,9 @@ foreach(comp ${lib3mf_FIND_COMPONENTS})
endforeach()

# Configure paths based on the selected variant
set(lib3mf_INCLUDE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../include/Bindings/${lib3mf_selected_variant}")
set(lib3mf_LIBRARY_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../lib")
set(lib3mf_BINARY_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../bin")
set(lib3mf_INCLUDE_DIR "${LIB3MF_ROOT_DIR}/include/Bindings/${lib3mf_selected_variant}")
set(lib3mf_LIBRARY_DIR "${LIB3MF_ROOT_DIR}/lib")
set(lib3mf_BINARY_DIR "${LIB3MF_ROOT_DIR}/bin")

# Adjust library file name based on platform
if(WIN32)
Expand Down Expand Up @@ -43,7 +52,7 @@ if("${lib3mf_selected_variant}" STREQUAL "CppDynamic" OR "${lib3mf_selected_vari
message(" You must append this to your sources ")
message("")
message("*****************************************************************************")
set(LIB3MF_CDYNAMIC_ADDITIONAL_SOURCE "${CMAKE_CURRENT_LIST_DIR}/../../../include/Bindings/CDynamic/lib3mf_dynamic.cc")
set(LIB3MF_CDYNAMIC_ADDITIONAL_SOURCE "${LIB3MF_ROOT_DIR}/include/Bindings/CDynamic/lib3mf_dynamic.cc")
endif()
add_library(lib3mfdynamic INTERFACE)
# Now alias lib3mfdynamic to include the namespace
Expand Down Expand Up @@ -87,4 +96,4 @@ else()
message(WARNING "Target '${target}' not found. lib3mf library was not copied.")
endif()
endfunction()
endif()
endif()

0 comments on commit f96fc53

Please sign in to comment.