diff --git a/SDK/CPackExamples/Cpp/CMakeLists.txt b/SDK/CPackExamples/Cpp/CMakeLists.txt index e75ad0874..5697a68b2 100644 --- a/SDK/CPackExamples/Cpp/CMakeLists.txt +++ b/SDK/CPackExamples/Cpp/CMakeLists.txt @@ -2,14 +2,20 @@ cmake_minimum_required (VERSION 3.5) project(Examples) set(CMAKE_CXX_STANDARD 11) +# read the version of the 3MF Library from en environment variable LIB3MF_VERSION +if (DEFINED ENV{LIB3MF_VERSION}) + set(LIB3MF_VERSION $ENV{LIB3MF_VERSION}) +else() + set(LIB3MF_VERSION "2.3.1") + # Determine the platform and set lib3mf_DIR accordingly if(WIN32) # Path for Windows - set(lib3mf_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../lib3mf-2.3.1-Windows/lib/cmake/lib3mf") + set(lib3mf_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../lib3mf-${LIB3MF_VERSION}-Windows/lib/cmake/lib3mf") find_package(lib3mf REQUIRED COMPONENTS Cpp) elseif(APPLE) # Path for macOS (Darwin) - set(lib3mf_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../lib3mf-2.3.1-Darwin/lib/cmake/lib3mf") + set(lib3mf_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../lib3mf-${LIB3MF_VERSION}-Darwin/lib/cmake/lib3mf") find_package(lib3mf REQUIRED COMPONENTS Cpp) else() # Path for Linux (Here we check twice to test for Debian / RPM packages properly) @@ -17,7 +23,7 @@ else() # Check if the package was not found if(NOT lib3mf_FOUND) # lib3mf not found, so set lib3mf_DIR to the fallback directory - set(lib3mf_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../lib3mf-2.3.1-Linux/lib/cmake/lib3mf") + set(lib3mf_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../lib3mf-${LIB3MF_VERSION}-Linux/lib/cmake/lib3mf") # Find package (lib3mf) find_package(lib3mf REQUIRED COMPONENTS Cpp) endif() diff --git a/SDK/CPackExamples/CppDynamic/CMakeLists.txt b/SDK/CPackExamples/CppDynamic/CMakeLists.txt index 4fee96e92..d896df0f0 100644 --- a/SDK/CPackExamples/CppDynamic/CMakeLists.txt +++ b/SDK/CPackExamples/CppDynamic/CMakeLists.txt @@ -39,14 +39,21 @@ cmake_minimum_required(VERSION 3.5) project(Example_ExtractInfo) set(CMAKE_CXX_STANDARD 11) + +# read the version of the 3MF Library from en environment variable LIB3MF_VERSION +if (DEFINED ENV{LIB3MF_VERSION}) + set(LIB3MF_VERSION $ENV{LIB3MF_VERSION}) +else() + set(LIB3MF_VERSION "2.3.1") + # Determine the platform and set lib3mf_DIR accordingly if(WIN32) # Path for Windows - set(lib3mf_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../lib3mf-2.3.1-Windows/lib/cmake/lib3mf") + set(lib3mf_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../lib3mf-${LIB3MF_VERSION}-Windows/lib/cmake/lib3mf") find_package(lib3mf REQUIRED COMPONENTS CppDynamic) elseif(APPLE) # Path for macOS (Darwin) - set(lib3mf_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../lib3mf-2.3.1-Darwin/lib/cmake/lib3mf") + set(lib3mf_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../lib3mf-${LIB3MF_VERSION}-Darwin/lib/cmake/lib3mf") find_package(lib3mf REQUIRED COMPONENTS CppDynamic) else() # Path for Linux (Here we check twice to test for Debian / RPM packages properly) @@ -54,7 +61,7 @@ else() # Check if the package was not found if(NOT lib3mf_FOUND) # lib3mf not found, so set lib3mf_DIR to the fallback directory - set(lib3mf_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../lib3mf-2.3.1-Linux/lib/cmake/lib3mf") + set(lib3mf_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../lib3mf-${LIB3MF_VERSION}-Linux/lib/cmake/lib3mf") # Find package (lib3mf) find_package(lib3mf REQUIRED COMPONENTS CppDynamic) endif()