File dynamic_library_build.diff of Package tidy

From: adam.majer@suse.de
Date: 2016-06-02 12:28:27+0000

  + use standard cmake BUILD_SHARED_LIBS instead of BUILD_SHARED_LIB
  + build both static and dynamic libraries by default, instead
    of just static
  + link vs. dynamic by default
---
 CMakeLists.txt |   22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

Index: tidy-html5-5.8.0/CMakeLists.txt
===================================================================
--- tidy-html5-5.8.0.orig/CMakeLists.txt
+++ tidy-html5-5.8.0/CMakeLists.txt
@@ -91,15 +91,15 @@ endif ()
 #   shared library can be turned off if not needed. The console program
 #   can be configured for static linking or dynamic linking.
 #------------------------------------------------------------------------
-set( LIB_TYPE STATIC )  # set default message
+option( BUILD_STATIC_LIBS "Set ON to build static library"         ON )
 
-option( BUILD_SHARED_LIB "Set OFF to NOT build shared library"     ON  )
+option( BUILD_SHARED_LIBS "Set OFF to NOT build shared library"     ON  )
 
 # Issue #326 - Allow linkage choice of console app tidy
-option( TIDY_CONSOLE_SHARED "Set ON to link with shared(DLL) lib." OFF )
+option( TIDY_CONSOLE_SHARED "Set OFF to link with static lib." ON )
 
 if (TIDY_CONSOLE_SHARED)
-    if (NOT BUILD_SHARED_LIB)
+    if (NOT BUILD_SHARED_LIBS)
         message(FATAL_ERROR "Enable shared build for this tidy linkage!")
     endif ()
 endif ()
@@ -326,7 +326,7 @@ endif ()
 # Shared Library
 #   Setup whether or not we will build the shared library.
 #------------------------------------------------------------------------
-if(BUILD_SHARED_LIB)
+if(BUILD_SHARED_LIBS)
    set(LIB_TYPE SHARED)
    message(STATUS "*** Also building DLL library ${LIB_TYPE}, version ${LIBTIDY_VERSION}, date ${LIBTIDY_DATE}")
 else()
@@ -395,8 +395,8 @@ endif ()
 
 #------------------------------------------------------------------------
 # Static Library
-#   The static library always builds.
 #------------------------------------------------------------------------
+if (BUILD_STATIC_LIBS)
 set(name tidy-static)
 add_library ( ${name} STATIC ${CFILES} ${HFILES} ${LIBHFILES} )
 if (WIN32)
@@ -407,14 +407,17 @@ else ()
                            OUTPUT_NAME ${LIB_NAME} )
 
 endif ()
-if (NOT TIDY_CONSOLE_SHARED) # user wants default static linkage
+if (NOT TIDY_CONSOLE_SHARED) # user wants static linkage
     list ( APPEND add_LIBS ${name} )
 endif ()    
 install(TARGETS ${name}
-        RUNTIME DESTINATION ${BIN_INSTALL_DIR}
         ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
         LIBRARY DESTINATION ${LIB_INSTALL_DIR}
         )
+endif()
+install(TARGETS ${name}
+        RUNTIME DESTINATION ${BIN_INSTALL_DIR}
+        )
 install( FILES ${HFILES} DESTINATION ${INCLUDE_INSTALL_DIR} )
 if(MSVC)
     # install(FILES $<TARGET_PDB_FILE:${name}> DESTINATION lib OPTIONAL)
@@ -424,9 +427,8 @@ endif()
 
 #------------------------------------------------------------------------
 # Dynamic Library
-#   If the user option is still on.
 #------------------------------------------------------------------------
-if (BUILD_SHARED_LIB)
+if (BUILD_SHARED_LIBS)
     set(name tidy-share)
     if (UNIX AND APPLE)
         set(CMAKE_MACOSX_RPATH 1)
openSUSE Build Service is sponsored by