Skip to content

Add CMake compatibilty for MinGW #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
updating the local CMakeLists.txt file
  • Loading branch information
Oscar Sjoberg committed Feb 28, 2023
commit d79363fcd52040da6f09d1fb8a98608d8bfb18c7
28 changes: 19 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.15)
project(libvideo-defs VERSION 1.0)
project(video-defs VERSION 1.0)

set(LIB_SOURCES
src/vdefs.c
Expand All @@ -8,21 +8,31 @@ set(LIB_SOURCES
src/vdefs_params.c
)

add_library(video-defs ${LIB_SOURCES})
add_library(video-defs_compiler_flags INTERFACE)
target_compile_features(video-defs_compiler_flags INTERFACE cxx_std_11)
add_library(${PROJECT_NAME} ${LIB_SOURCES})
target_compile_features(${PROJECT_NAME} INTERFACE cxx_std_11)

option(BUILD_SHARED_LIBS "Build using shared libraries" ON)

target_include_directories(video-defs PUBLIC
target_include_directories(${PROJECT_NAME} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)

target_compile_definitions(video-defs PRIVATE "VDEF_API_EXPORTS")
target_compile_definitions(video-defs PRIVATE "_GNU_SOURCE")
target_compile_definitions(${PROJECT_NAME} PRIVATE "VDEF_API_EXPORTS")
target_compile_definitions(${PROJECT_NAME} PRIVATE "_GNU_SOURCE")


find_package(json-c CONFIG REQUIRED)
target_link_libraries(video-defs PUBLIC json-c::json-c json-c::json-c-static)
target_link_libraries(video-defs PUBLIC ulog h264 h265 video-defs_compiler_flags)
target_link_libraries(${PROJECT_NAME} PUBLIC
json-c::json-c
json-c::json-c-static
ulog
h264
h265
)

install(TARGETS ${PROJECT_NAME}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_PREFIX}/include/${PROJECT_NAME}
LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/${PROJECT_NAME}
ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/${PROJECT_NAME}
)