diff --git a/CMakeLists.txt b/CMakeLists.txt index 9a20941..945c5a4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,8 +4,8 @@ include(CheckCSourceCompiles) +cmake_minimum_required(VERSION 3.12) project ( YUV C CXX ) # "C" is required even for C++ projects -cmake_minimum_required( VERSION 2.8.12 ) option( UNIT_TEST "Built unit tests" OFF ) set ( ly_base_dir ${PROJECT_SOURCE_DIR} ) @@ -164,7 +164,8 @@ target_link_libraries ( yuvconstants ${ly_lib_static} ) find_package ( JPEG ) if (JPEG_FOUND) include_directories( ${JPEG_INCLUDE_DIR} ) - target_link_libraries( ${ly_lib_shared} ${JPEG_LIBRARY} ) + target_link_libraries( ${ly_lib_static} PRIVATE JPEG::JPEG ) + target_link_libraries( ${ly_lib_shared} PRIVATE JPEG::JPEG ) add_definitions( -DHAVE_JPEG ) endif() @@ -211,9 +212,18 @@ endif() # install the conversion tool, .so, .a, and all the header files -install ( PROGRAMS ${CMAKE_BINARY_DIR}/yuvconvert DESTINATION bin ) -install ( TARGETS ${ly_lib_static} DESTINATION lib ) -install ( TARGETS ${ly_lib_shared} LIBRARY DESTINATION lib RUNTIME DESTINATION bin ) +install(TARGETS yuvconvert) +if(BUILD_SHARED_LIBS) + target_include_directories(${ly_lib_shared} PUBLIC $) + install(TARGETS ${ly_lib_shared} EXPORT libyuv-targets) + set_target_properties(${ly_lib_shared} PROPERTIES EXPORT_NAME "${ly_lib_static}") # vcpkg legacy + add_definitions(-DLIBYUV_BUILDING_SHARED_LIBRARY) +else() + target_include_directories(${ly_lib_static} PUBLIC $) + install(TARGETS ${ly_lib_static} EXPORT libyuv-targets) + set_target_properties(${ly_lib_shared} PROPERTIES EXCLUDE_FROM_ALL 1) +endif() +install(EXPORT libyuv-targets DESTINATION share/libyuv) install ( DIRECTORY ${PROJECT_SOURCE_DIR}/include/ DESTINATION include ) # create the .deb and .rpm packages using cpack