diff --git a/compositemodel/CMakeLists.txt b/compositemodel/CMakeLists.txt index 2cf24215..ce4551ee 100644 --- a/compositemodel/CMakeLists.txt +++ b/compositemodel/CMakeLists.txt @@ -127,6 +127,12 @@ execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINAR include(CMakePackageConfigHelpers) +target_include_directories(GoCompositeModel INTERFACE + $ +) + +export(TARGETS GoCompositeModel FILE GoCompositeModelTargets.cmake) + # 'install' target IF(WIN32) # Windows diff --git a/gotools-core/CMakeLists.txt b/gotools-core/CMakeLists.txt index 5a2184ce..ab7b0190 100644 --- a/gotools-core/CMakeLists.txt +++ b/gotools-core/CMakeLists.txt @@ -112,6 +112,13 @@ ELSE(WIN32) include(GNUInstallDirs) ENDIF(WIN32) +target_include_directories(GoToolsCore INTERFACE + $ + $ +) + +export(TARGETS GoToolsCore FILE GoToolsCoreTargets.cmake) + # Install the GoToolsCore target install(TARGETS GoToolsCore EXPORT GoToolsCoreTargets diff --git a/igeslib/CMakeLists.txt b/igeslib/CMakeLists.txt index 6c6f576b..cb9cf80e 100644 --- a/igeslib/CMakeLists.txt +++ b/igeslib/CMakeLists.txt @@ -67,6 +67,12 @@ endif() include(CMakePackageConfigHelpers) +target_include_directories(GoIgeslib INTERFACE + $ +) + +export(TARGETS GoIgeslib FILE GoIgeslibTargets.cmake) + # 'install' target IF(WIN32) # Windows diff --git a/implicitization/CMakeLists.txt b/implicitization/CMakeLists.txt index 90eb46be..e30bc0ca 100644 --- a/implicitization/CMakeLists.txt +++ b/implicitization/CMakeLists.txt @@ -74,6 +74,12 @@ endif() include(CMakePackageConfigHelpers) +target_include_directories(GoImplicitization INTERFACE + $ +) + +export(TARGETS GoImplicitization FILE GoImplicitizationTargets.cmake) + # 'install' target IF(WIN32) # Windows diff --git a/intersections/CMakeLists.txt b/intersections/CMakeLists.txt index f9bc3a4e..77b1b3f1 100644 --- a/intersections/CMakeLists.txt +++ b/intersections/CMakeLists.txt @@ -55,6 +55,12 @@ ENDIF(GoTools_COMPILE_APPS) include(CMakePackageConfigHelpers) +target_include_directories(GoIntersections INTERFACE + $ +) + +export(TARGETS GoIntersections FILE GoIntersectionsTargets.cmake) + # 'install' target IF(WIN32) # Windows diff --git a/isogeometric_model/CMakeLists.txt b/isogeometric_model/CMakeLists.txt index e8a332c8..6f2dc0ab 100644 --- a/isogeometric_model/CMakeLists.txt +++ b/isogeometric_model/CMakeLists.txt @@ -89,6 +89,12 @@ endif() include(CMakePackageConfigHelpers) +target_include_directories(GoIsogeometricModel INTERFACE + $ +) + +export(TARGETS GoIsogeometricModel FILE GoIsogeometricModelTargets.cmake) + # 'install' target IF(WIN32) # Windows diff --git a/lrsplines2D/CMakeLists.txt b/lrsplines2D/CMakeLists.txt index 6a450fbe..46241be0 100644 --- a/lrsplines2D/CMakeLists.txt +++ b/lrsplines2D/CMakeLists.txt @@ -118,6 +118,12 @@ ELSE(WIN32) include(GNUInstallDirs) ENDIF(WIN32) +target_include_directories(GoLRspline2D INTERFACE + $ +) + +export(TARGETS GoLRspline2D FILE GoLRsplines2DTargets.cmake) + # Install the GoLRspline2D target install(TARGETS GoLRspline2D EXPORT GoLRspline2DTargets diff --git a/lrsplines3D/CMakeLists.txt b/lrsplines3D/CMakeLists.txt index 52ea62da..40e9c632 100644 --- a/lrsplines3D/CMakeLists.txt +++ b/lrsplines3D/CMakeLists.txt @@ -155,6 +155,12 @@ ELSE(WIN32) include(GNUInstallDirs) ENDIF(WIN32) +target_include_directories(GoLRspline3D INTERFACE + $ +) + +export(TARGETS GoLRspline3D FILE GoLRsplines3DTargets.cmake) + # Install the GoLRspline2D target install(TARGETS GoLRspline3D EXPORT GoLRspline3DTargets diff --git a/newmat/CMakeLists.txt b/newmat/CMakeLists.txt index bef627e7..e6a06128 100644 --- a/newmat/CMakeLists.txt +++ b/newmat/CMakeLists.txt @@ -71,6 +71,12 @@ ENDIF() # === Install Targets and Export CMake Package === include(CMakePackageConfigHelpers) +target_include_directories(newmat INTERFACE + $ +) + +export(TARGETS newmat FILE newmatTargets.cmake) + # Install the newmat target with export install(TARGETS newmat EXPORT NewmatTargets diff --git a/parametrization/CMakeLists.txt b/parametrization/CMakeLists.txt index 679c40be..cc22bc2e 100644 --- a/parametrization/CMakeLists.txt +++ b/parametrization/CMakeLists.txt @@ -61,6 +61,12 @@ endif() include(CMakePackageConfigHelpers) +target_include_directories(parametrization INTERFACE + $ +) + +export(TARGETS parametrization FILE parametrizationTargets.cmake) + # 'install' target IF(WIN32) # Windows diff --git a/qualitymodule/CMakeLists.txt b/qualitymodule/CMakeLists.txt index 43a03885..b8a1f969 100644 --- a/qualitymodule/CMakeLists.txt +++ b/qualitymodule/CMakeLists.txt @@ -81,6 +81,12 @@ ENDIF(GoTools_COMPILE_TESTS) include(CMakePackageConfigHelpers) +target_include_directories(GoQualityModule INTERFACE + $ +) + +export(TARGETS GoQualityModule FILE GoQualityModuleTargets.cmake) + # 'install' target IF(WIN32) # Windows diff --git a/sisl b/sisl index 7e55b549..e854a48f 160000 --- a/sisl +++ b/sisl @@ -1 +1 @@ -Subproject commit 7e55b5495c8e8bb2c93670de52a67fc312bddd7d +Subproject commit e854a48fc5a169d2562fa54237ecb3574c37bd6b diff --git a/topology/CMakeLists.txt b/topology/CMakeLists.txt index 7ad069df..96ab6768 100644 --- a/topology/CMakeLists.txt +++ b/topology/CMakeLists.txt @@ -66,6 +66,12 @@ ENDIF(GoTools_COMPILE_TESTS) include(CMakePackageConfigHelpers) +target_include_directories(GoTopology INTERFACE + $ +) + +export(TARGETS GoTopology FILE GoTopologyTargets.cmake) + # 'install' target IF(WIN32) # Windows diff --git a/trivariate/CMakeLists.txt b/trivariate/CMakeLists.txt index 7c77bfb4..77d26a55 100644 --- a/trivariate/CMakeLists.txt +++ b/trivariate/CMakeLists.txt @@ -94,6 +94,13 @@ install(DIRECTORY include/ FILES_MATCHING PATTERN "*.h" ) +target_include_directories(GoTrivariate INTERFACE + $ + $ +) + +export(TARGETS GoTrivariate FILE GoTrivariateTargets.cmake) + # Export the targets to a file install(EXPORT GoTrivariateTargets FILE GoTrivariateTargets.cmake diff --git a/trivariatemodel/CMakeLists.txt b/trivariatemodel/CMakeLists.txt index 19dee69a..89b5f0fa 100644 --- a/trivariatemodel/CMakeLists.txt +++ b/trivariatemodel/CMakeLists.txt @@ -101,6 +101,12 @@ endif() include(CMakePackageConfigHelpers) +target_include_directories(GoTrivariateModel INTERFACE + $ +) + +export(TARGETS GoTrivariateModel FILE GoTrivariateModelTargets.cmake) + # 'install' target IF(WIN32) # Windows diff --git a/ttl b/ttl index 0f57e660..9014d0b2 160000 --- a/ttl +++ b/ttl @@ -1 +1 @@ -Subproject commit 0f57e660635925851d8646378c462a68ccdc8297 +Subproject commit 9014d0b2f9d5672d76283e38fa9fb5c4f15f1bdb diff --git a/viewlib/CMakeLists.txt b/viewlib/CMakeLists.txt index 9a500085..65774749 100644 --- a/viewlib/CMakeLists.txt +++ b/viewlib/CMakeLists.txt @@ -286,60 +286,92 @@ endif(ViewlibVolAndLRSupport) # Create a tmp dir for generated data. execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/tmp) -# 'install' target -if(WIN32) +# === Install Targets and Export Package === + +include(CMakePackageConfigHelpers) + +# 1. Setup Installation Paths +IF(WIN32) # Windows - # lib - install(TARGETS viewlib DESTINATION ${GoTools_INSTALL_PREFIX}/lib) - # include - install(DIRECTORY include/GoTools/viewlib - DESTINATION ${GoTools_INSTALL_PREFIX}/include/GoTools - FILES_MATCHING PATTERN "*.h" - PATTERN ".svn" EXCLUDE - ) - # include ui files - install(DIRECTORY ${viewlib_BINARY_DIR}/include/GoTools/viewlib/ - DESTINATION ${GoTools_INSTALL_PREFIX}/include/GoTools/viewlib - FILES_MATCHING PATTERN "ui_*_form.h" - PATTERN ".svn" EXCLUDE - ) - # data - install(DIRECTORY data/ - DESTINATION ${GoTools_INSTALL_PREFIX}/share/viewlib - FILES_MATCHING PATTERN "*.g2" PATTERN "*.igs" - PATTERN ".svn" EXCLUDE - ) - # bin - set(goview_INSTALL_PREFIX "$ENV{PROGRAMFILES}/SINTEF/goview" - CACHE PATH "Path to install goview") - install(TARGETS goview DESTINATION ${goview_INSTALL_PREFIX}) -else() + # Note: Ensure GoTools_WINDOWS_INSTALL_PREFIX is defined in your root CMakeLists or cache + set(CMAKE_INSTALL_LIBDIR ${GoTools_WINDOWS_INSTALL_PREFIX}/lib) + set(CMAKE_INSTALL_INCLUDEDIR ${GoTools_WINDOWS_INSTALL_PREFIX}/include) + set(CMAKE_INSTALL_BINDIR ${GoTools_WINDOWS_INSTALL_PREFIX}/bin) + set(CMAKE_INSTALL_DATADIR ${GoTools_WINDOWS_INSTALL_PREFIX}/share) +ELSE(WIN32) # Linux - # lib - install(TARGETS viewlib DESTINATION lib COMPONENT viewlib) - # include - install(DIRECTORY include/GoTools/viewlib - DESTINATION include/GoTools - COMPONENT viewlib-dev - FILES_MATCHING PATTERN "*.h" - PATTERN ".svn" EXCLUDE - ) - # include ui files - install(DIRECTORY ${viewlib_BINARY_DIR}/include/GoTools/viewlib/ - DESTINATION include/GoTools/viewlib - COMPONENT viewlib-dev - FILES_MATCHING PATTERN "ui_*_form.h" - PATTERN ".svn" EXCLUDE - ) - # data - install(DIRECTORY data/ - DESTINATION share/GoTools/viewlib - COMPONENT viewlib - FILES_MATCHING PATTERN "*.g2" PATTERN "*.igs" - PATTERN ".svn" EXCLUDE - ) - # bin - install(TARGETS goview DESTINATION bin COMPONENT viewlib) -endif() + include(GNUInstallDirs) +ENDIF(WIN32) + +# 2. Define Interface Include Directories for the Build Tree +target_include_directories(viewlib INTERFACE + $ + # If viewlib relies on other internal headers, add them here +) + +# 3. Export Targets to Build Tree +export(TARGETS viewlib FILE viewlibTargets.cmake) + +# 4. Install Targets (Library and Executable) +# This handles both the library (viewlib) and the app (goview) +install(TARGETS viewlib goview + EXPORT viewlibTargets + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +) + +# 5. Install Headers +# Standard headers +install(DIRECTORY include/GoTools/viewlib + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/GoTools + FILES_MATCHING PATTERN "*.h" + PATTERN ".svn" EXCLUDE +) + +# Generated UI headers (from binary dir) +install(DIRECTORY ${viewlib_BINARY_DIR}/include/GoTools/viewlib/ + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/GoTools/viewlib + FILES_MATCHING PATTERN "ui_*_form.h" + PATTERN ".svn" EXCLUDE +) + +# 6. Install Data Files +install(DIRECTORY data/ + DESTINATION ${CMAKE_INSTALL_DATADIR}/GoTools/viewlib + FILES_MATCHING PATTERN "*.g2" PATTERN "*.igs" + PATTERN ".svn" EXCLUDE +) + +# 7. Install Export File (for use by other projects) +install(EXPORT viewlibTargets + FILE viewlibTargets.cmake + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/viewlib +) + +# 8. Generate Version File +write_basic_package_version_file( + "${CMAKE_CURRENT_BINARY_DIR}/viewlibConfigVersion.cmake" + # Assuming viewlib shares the GoTools version, otherwise change to ${viewlib_VERSION...} + VERSION ${GoTools_VERSION_MAJOR}.${GoTools_VERSION_MINOR}.${GoTools_VERSION_PATCH} + COMPATIBILITY SameMajorVersion +) + +# 9. Generate Config File from Template +# Ensure you have a 'viewlibConfig.cmake.in' in your 'cmake/' folder +configure_package_config_file( + "${CMAKE_CURRENT_SOURCE_DIR}/cmake/viewlibConfig.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/viewlibConfig.cmake" + INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/viewlib +) + +# 10. Install the Config Files +install(FILES + "${CMAKE_CURRENT_BINARY_DIR}/viewlibConfig.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/viewlibConfigVersion.cmake" + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/viewlib +) -set(CPACK_STRIP_FILES ${CPACK_STRIP_FILES} libviewlib.so) +# Optional stripping +SET(CPACK_STRIP_FILES ${CPACK_STRIP_FILES} libviewlib.so) diff --git a/viewlib/cmake/viewlibConfig.cmake.in b/viewlib/cmake/viewlibConfig.cmake.in index 3995b0ba..bec1ff03 100644 --- a/viewlib/cmake/viewlibConfig.cmake.in +++ b/viewlib/cmake/viewlibConfig.cmake.in @@ -2,7 +2,8 @@ include("${CMAKE_CURRENT_LIST_DIR}/viewlibTargets.cmake") -set(VIEWLIB_INCLUDE_DIRS "@CMAKE_INSTALL_INCLUDEDIR@") +# Legacy compatibility set(VIEWLIB_LIBRARIES viewlib) -check_required_components(viewlib) +# Optionally set variables +set(VIEWLIB_INCLUDE_DIRS "@CMAKE_INSTALL_INCLUDEDIR@/include")