]> granicus.if.org Git - openjpeg/commitdiff
[trunk] Make openjpip a first class shared lib, for future linking
authorMathieu Malaterre <mathieu.malaterre@gmail.com>
Fri, 5 Oct 2012 17:05:06 +0000 (17:05 +0000)
committerMathieu Malaterre <mathieu.malaterre@gmail.com>
Fri, 5 Oct 2012 17:05:06 +0000 (17:05 +0000)
src/bin/jpip/CMakeLists.txt
src/lib/openjpip/CMakeLists.txt

index 6106e0d23f3270da2e34fe90aeb64c90c1823242..f143388787162abce5f558f170cf525780716766 100644 (file)
@@ -48,7 +48,7 @@ set(EXES
   )
 foreach(exe ${EXES})
   add_executable(${exe} ${exe}.c)
-  target_link_libraries(${exe} openjpip_local)
+  target_link_libraries(${exe} openjpip)
   install(TARGETS ${exe}
     EXPORT OpenJPEGTargets
     DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
index 47eb24acda82200437ef0438cf52b8e7d85e7e54..814d2931ada218b555fd961baead8750e7b6179e 100644 (file)
@@ -56,17 +56,28 @@ set(LOCAL_SRCS
   )
 
 # Build the library
-add_library(openjpip_local STATIC ${OPENJPIP_SRCS} ${LOCAL_SRCS})
-target_link_libraries(openjpip_local ${OPENJPEG_LIBRARY_NAME})
+if(WIN32)
+  if(BUILD_SHARED_LIBS)
+    add_definitions(-DOPJ_EXPORTS)
+  else()
+    add_definitions(-DOPJ_STATIC)
+  endif()
+endif()
+add_library(openjpip ${OPENJPIP_SRCS} ${LOCAL_SRCS})
+set_target_properties(openjpip
+  PROPERTIES ${OPENJPEG_LIBRARY_PROPERTIES})
+target_link_libraries(openjpip ${OPENJPEG_LIBRARY_NAME})
 if(WIN32)
   # add Winsock on windows+mingw
-  target_link_libraries(openjpip_local ws2_32)
+  target_link_libraries(openjpip ws2_32)
 endif()
 
 # Install library
-install(TARGETS openjpip_local
+install(TARGETS openjpip
   EXPORT OpenJPEGTargets
-  DESTINATION ${OPENJPEG_INSTALL_LIB_DIR} COMPONENT Libraries
+  RUNTIME DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
+  LIBRARY DESTINATION ${OPENJPEG_INSTALL_LIB_DIR} COMPONENT Libraries
+  ARCHIVE DESTINATION ${OPENJPEG_INSTALL_LIB_DIR} COMPONENT Libraries
   )
 
 if(BUILD_JPIP_SERVER)