ソースを参照

cmake: Do not install static libraries in shared build mode.

The glslang cmake build system installs static libraries in addition to
the dynamic glslang library, which are required when used in a package
that uses glslang when calling find_package().

Distributions such as openSUSE (and perhaps others) use a "shared only"
strategy, which conflicts with the current state of the glslang build
system.
The static libraries mentioned are already all included in glslang and
thus not needed. With this commit, these will no longer install the
associated cmake support files when glslang is built shared.
Ralf Habacker 3 年 前
コミット
7cd519511c

+ 2 - 2
OGLCompilersDLL/CMakeLists.txt

@@ -41,7 +41,7 @@ if(WIN32)
     source_group("Source" FILES ${SOURCES})
     source_group("Source" FILES ${SOURCES})
 endif(WIN32)
 endif(WIN32)
 
 
-if(ENABLE_GLSLANG_INSTALL)
+if(ENABLE_GLSLANG_INSTALL AND NOT BUILD_SHARED_LIBS)
     install(TARGETS OGLCompiler EXPORT glslang-targets)
     install(TARGETS OGLCompiler EXPORT glslang-targets)
 
 
     # Backward compatibility
     # Backward compatibility
@@ -56,4 +56,4 @@ if(ENABLE_GLSLANG_INSTALL)
     ")
     ")
     install(FILES "${CMAKE_CURRENT_BINARY_DIR}/OGLCompilerTargets.cmake" DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)
     install(FILES "${CMAKE_CURRENT_BINARY_DIR}/OGLCompilerTargets.cmake" DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)
 
 
-endif(ENABLE_GLSLANG_INSTALL)
+endif()

+ 22 - 20
glslang/CMakeLists.txt

@@ -201,26 +201,28 @@ endif()
 ################################################################################
 ################################################################################
 if(ENABLE_GLSLANG_INSTALL)
 if(ENABLE_GLSLANG_INSTALL)
     install(TARGETS glslang EXPORT glslang-targets)
     install(TARGETS glslang EXPORT glslang-targets)
-    install(TARGETS MachineIndependent EXPORT glslang-targets)
-    install(TARGETS GenericCodeGen EXPORT glslang-targets)
-
-    # Backward compatibility
-    file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/glslangTargets.cmake" "
-        message(WARNING \"Using `glslangTargets.cmake` is deprecated: use `find_package(glslang)` to find glslang CMake targets.\")
-
-        if (NOT TARGET glslang::glslang)
-            include(\"\${CMAKE_CURRENT_LIST_DIR}/../../${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}/glslang-targets.cmake\")
-        endif()
-
-        if(${BUILD_SHARED_LIBS})
-            add_library(glslang ALIAS glslang::glslang)
-        else()
-            add_library(glslang ALIAS glslang::glslang)
-            add_library(MachineIndependent ALIAS glslang::MachineIndependent)
-            add_library(GenericCodeGen ALIAS glslang::GenericCodeGen)
-        endif()
-    ")
-    install(FILES "${CMAKE_CURRENT_BINARY_DIR}/glslangTargets.cmake" DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)
+    if(NOT BUILD_SHARED_LIBS)
+        install(TARGETS MachineIndependent EXPORT glslang-targets)
+        install(TARGETS GenericCodeGen EXPORT glslang-targets)
+
+        # Backward compatibility
+        file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/glslangTargets.cmake" "
+            message(WARNING \"Using `glslangTargets.cmake` is deprecated: use `find_package(glslang)` to find glslang CMake targets.\")
+
+            if (NOT TARGET glslang::glslang)
+                include(\"\${CMAKE_CURRENT_LIST_DIR}/../../${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}/glslang-targets.cmake\")
+            endif()
+
+            if(${BUILD_SHARED_LIBS})
+                add_library(glslang ALIAS glslang::glslang)
+            else()
+                add_library(glslang ALIAS glslang::glslang)
+                add_library(MachineIndependent ALIAS glslang::MachineIndependent)
+                add_library(GenericCodeGen ALIAS glslang::GenericCodeGen)
+            endif()
+        ")
+        install(FILES "${CMAKE_CURRENT_BINARY_DIR}/glslangTargets.cmake" DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)
+    endif()
 
 
     set(ALL_HEADERS
     set(ALL_HEADERS
         ${GLSLANG_HEADERS}
         ${GLSLANG_HEADERS}

+ 1 - 1
glslang/OSDependent/Unix/CMakeLists.txt

@@ -52,7 +52,7 @@ else()
     target_link_libraries(OSDependent Threads::Threads)
     target_link_libraries(OSDependent Threads::Threads)
 endif()
 endif()
 
 
-if(ENABLE_GLSLANG_INSTALL)
+if(ENABLE_GLSLANG_INSTALL AND NOT BUILD_SHARED_LIBS)
     install(TARGETS OSDependent EXPORT glslang-targets)
     install(TARGETS OSDependent EXPORT glslang-targets)
 
 
     # Backward compatibility
     # Backward compatibility