Skip to content

Commit

Permalink
[build] Fixed CMake CMP0048 policy restriction (#1765)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxsharabayko committed Jan 29, 2021
1 parent 954968a commit 0d0888a
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions CMakeLists.txt
Expand Up @@ -8,14 +8,22 @@
#

cmake_minimum_required (VERSION 2.8.12 FATAL_ERROR)
# XXX This can be potentially done in future, but there still exist
# some dependent project using cmake 2.8 - this can't be done this way.
#cmake_minimum_required (VERSION 3.0.2 FATAL_ERROR)
#project(SRT VERSION "1.4.2")
project(SRT C CXX)
set (SRT_VERSION 1.4.2)

set (CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/scripts")
include(haiUtil)
include(haiUtil) # needed for set_version_variables
# CMake version 3.0 introduced the VERSION option of the project() command
# to specify a project version as well as the name.
if(${CMAKE_VERSION} VERSION_LESS "3.0.0")
project(SRT C CXX)
# Sets SRT_VERSION_MAJOR, SRT_VERSION_MINOR, SRT_VERSION_PATCH
set_version_variables(SRT_VERSION ${SRT_VERSION})
else()
cmake_policy(SET CMP0048 NEW)
# Also sets SRT_VERSION_MAJOR, SRT_VERSION_MINOR, SRT_VERSION_PATCH
project(SRT VERSION ${SRT_VERSION} LANGUAGES C CXX)
endif()

include(FindPkgConfig)
# XXX See 'if (MINGW)' condition below, may need fixing.
include(FindThreads)
Expand Down Expand Up @@ -43,9 +51,6 @@ if (NOT DEFINED CMAKE_INSTALL_LIBDIR)
include(GNUInstallDirs)
endif()

set (SRT_VERSION 1.4.2)
set_version_variables(SRT_VERSION ${SRT_VERSION})

# The CMAKE_BUILD_TYPE seems not to be always set, weird.
if (NOT DEFINED ENABLE_DEBUG)

Expand Down Expand Up @@ -775,8 +780,6 @@ MafReadDir(srtcore filelist.maf
PRIVATE_HEADERS HEADERS_srt_private
)

message(STATUS "SRT Sources: ${SOURCES_srt}")

# Auto generated version file and add it to the HEADERS_srt list.
if(DEFINED ENV{APPVEYOR_BUILD_NUMBER})
set(SRT_VERSION_BUILD ON)
Expand Down Expand Up @@ -1199,8 +1202,6 @@ if (ENABLE_UNITTESTS AND ENABLE_CXX11)
MafReadDir(test filelist.maf
SOURCES SOURCES_unittests
)

message(STATUS "Unit test sources: ${SOURCES_unittests}")

srt_add_program(test-srt ${SOURCES_unittests})
srt_make_application(test-srt)
Expand Down

0 comments on commit 0d0888a

Please sign in to comment.