|
| 1 | +From 95dd62cea5e195f51a7ec25041b072d47aa63fa9 Mon Sep 17 00:00:00 2001 |
| 2 | +From: qianlongxu < [email protected]> |
| 3 | +Date: Tue, 14 Jan 2025 17:38:01 +0800 |
| 4 | +Subject: [PATCH] not install binary and shared lib |
| 5 | + |
| 6 | +--- |
| 7 | + CMakeLists.txt | 17 +++++++++++++++-- |
| 8 | + 1 file changed, 15 insertions(+), 2 deletions(-) |
| 9 | + |
| 10 | +diff --git a/CMakeLists.txt b/CMakeLists.txt |
| 11 | +index 636531e..52a6b95 100644 |
| 12 | +--- a/CMakeLists.txt |
| 13 | ++++ b/CMakeLists.txt |
| 14 | +@@ -5,6 +5,7 @@ |
| 15 | + PROJECT ( YUV C CXX ) # "C" is required even for C++ projects |
| 16 | + CMAKE_MINIMUM_REQUIRED( VERSION 2.8 ) |
| 17 | + OPTION( TEST "Built unit tests" OFF ) |
| 18 | ++OPTION( BINARY "Built binary" OFF ) |
| 19 | + |
| 20 | + SET ( ly_base_dir ${PROJECT_SOURCE_DIR} ) |
| 21 | + SET ( ly_src_dir ${ly_base_dir}/source ) |
| 22 | +@@ -25,15 +26,19 @@ INCLUDE_DIRECTORIES( BEFORE ${ly_inc_dir} ) |
| 23 | + # this creates the static library (.a) |
| 24 | + ADD_LIBRARY ( ${ly_lib_static} STATIC ${ly_source_files} ) |
| 25 | + |
| 26 | ++if(BUILD_SHARED_LIBS) |
| 27 | + # this creates the shared library (.so) |
| 28 | + ADD_LIBRARY ( ${ly_lib_shared} SHARED ${ly_source_files} ) |
| 29 | ++ |
| 30 | + SET_TARGET_PROPERTIES ( ${ly_lib_shared} PROPERTIES OUTPUT_NAME "${ly_lib_name}" ) |
| 31 | + SET_TARGET_PROPERTIES ( ${ly_lib_shared} PROPERTIES PREFIX "lib" ) |
| 32 | ++endif() |
| 33 | + |
| 34 | + # this creates the conversion tool |
| 35 | ++if(BINARY) |
| 36 | + ADD_EXECUTABLE ( yuvconvert ${ly_base_dir}/util/yuvconvert.cc ) |
| 37 | + TARGET_LINK_LIBRARIES ( yuvconvert ${ly_lib_static} ) |
| 38 | +- |
| 39 | ++endif() |
| 40 | + |
| 41 | + INCLUDE ( FindJPEG ) |
| 42 | + if (JPEG_FOUND) |
| 43 | +@@ -75,9 +80,17 @@ endif() |
| 44 | + |
| 45 | + |
| 46 | + # install the conversion tool, .so, .a, and all the header files |
| 47 | ++if(BINARY) |
| 48 | ++message("The BINARY option is enabled.") |
| 49 | + INSTALL ( PROGRAMS ${CMAKE_BINARY_DIR}/yuvconvert DESTINATION bin ) |
| 50 | +-INSTALL ( TARGETS ${ly_lib_static} DESTINATION lib ) |
| 51 | ++endif() |
| 52 | ++ |
| 53 | ++if(BUILD_SHARED_LIBS) |
| 54 | ++message("The BUILD_SHARED_LIBS option is enabled.") |
| 55 | + INSTALL ( TARGETS ${ly_lib_shared} LIBRARY DESTINATION lib RUNTIME DESTINATION bin ) |
| 56 | ++endif() |
| 57 | ++ |
| 58 | ++INSTALL ( TARGETS ${ly_lib_static} DESTINATION lib ) |
| 59 | + INSTALL ( DIRECTORY ${PROJECT_SOURCE_DIR}/include/ DESTINATION include ) |
| 60 | + |
| 61 | + # create the .deb and .rpm packages using cpack |
| 62 | +-- |
| 63 | +2.39.5 (Apple Git-154) |
| 64 | + |
0 commit comments