Skip to content

Commit 708f325

Browse files
committed
Modernize project for CMake 3.1+
1 parent 6ee1ab1 commit 708f325

File tree

1 file changed

+29
-23
lines changed

1 file changed

+29
-23
lines changed

CMakeLists.txt

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
#
77
# Copyright (c) 2008-2014 OpenShot Studios, LLC
88
# <http://www.openshotstudios.com/>. This file is part of
9-
# OpenShot Library (libopenshot), an open-source project dedicated to
10-
# delivering high quality video editing and animation solutions to the
9+
# OpenShot Library (libopenshot), an open-source project dedicated to
10+
# delivering high quality video editing and animation solutions to the
1111
# world. For more information visit <http://www.openshot.org/>.
1212
#
1313
# OpenShot Library (libopenshot) is free software: you can redistribute it
@@ -24,24 +24,29 @@
2424
# along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
2525
################################################################################
2626

27-
cmake_minimum_required(VERSION 2.8.11)
27+
cmake_minimum_required(VERSION 3.1...3.14 FATAL_ERROR)
2828

29-
MESSAGE("--------------------------------------------------------------")
30-
MESSAGE("Welcome to the OpenShot Build System! CMake will now check for all required build")
31-
MESSAGE("dependencies and notify you of any missing files or other issues. If you have any")
32-
MESSAGE("questions or issues, please visit <http://www.openshot.org/>.")
29+
message("\
30+
-----------------------------------------------------------------
31+
Welcome to the OpenShot Build System!
32+
33+
CMake will now check libopenshot's build dependencies and inform
34+
you of any missing files or other issues.
35+
36+
For more information, please visit <http://www.openshot.org/>.
37+
-----------------------------------------------------------------")
3338

3439
################ ADD CMAKE MODULES ##################
3540
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules")
3641

3742
################ GET VERSION INFORMATION FROM VERSION.H ##################
38-
MESSAGE("--------------------------------------------------------------")
39-
MESSAGE("Determining Version Number (from Version.h file)")
43+
message(STATUS "Determining Version Number (from Version.h file)")
4044

4145
#### Get the lines related to libopenshot version from the Version.h header
42-
file(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/include/Version.h OPENSHOT_VERSION_LINES
43-
REGEX "#define[ ]+OPENSHOT_VERSION_.*[0-9]+;.*")
44-
46+
file(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/include/Version.h
47+
OPENSHOT_VERSION_LINES
48+
REGEX "#define[ ]+OPENSHOT_VERSION_.*[0-9]+;.*")
49+
4550
#### Set each line into it's own variable
4651
list (GET OPENSHOT_VERSION_LINES 0 LINE_MAJOR)
4752
list (GET OPENSHOT_VERSION_LINES 1 LINE_MINOR)
@@ -53,22 +58,23 @@ STRING(REGEX REPLACE "#define[ ]+OPENSHOT_VERSION_MAJOR[ ]+([0-9]+);(.*)" "\\1"
5358
STRING(REGEX REPLACE "#define[ ]+OPENSHOT_VERSION_MINOR[ ]+([0-9]+);(.*)" "\\1" MINOR_VERSION "${LINE_MINOR}")
5459
STRING(REGEX REPLACE "#define[ ]+OPENSHOT_VERSION_BUILD[ ]+([0-9]+);(.*)" "\\1" BUILD_VERSION "${LINE_BUILD}")
5560
STRING(REGEX REPLACE "#define[ ]+OPENSHOT_VERSION_SO[ ]+([0-9]+);(.*)" "\\1" SO_VERSION "${LINE_SO}")
56-
set(PROJECT_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${BUILD_VERSION}")
5761

58-
MESSAGE("--> MAJOR Version: ${MAJOR_VERSION}")
59-
MESSAGE("--> MINOR Version: ${MINOR_VERSION}")
60-
MESSAGE("--> BUILD Version: ${BUILD_VERSION}")
61-
MESSAGE("--> SO/API/ABI Version: ${SO_VERSION}")
62-
MESSAGE("--> VERSION: ${PROJECT_VERSION}")
63-
MESSAGE("")
62+
message(STATUS "Determining Version Number - done")
6463

6564
################### SETUP PROJECT ###################
66-
PROJECT(openshot)
67-
MESSAGE("--------------------------------------------------------------")
68-
MESSAGE("Generating build files for ${PROJECT_NAME} (${PROJECT_VERSION})")
65+
PROJECT(libopenshot LANGUAGES CXX
66+
VERSION ${MAJOR_VERSION}.${MINOR_VERSION}.${BUILD_VERSION})
67+
68+
message("\
69+
Generating build files for OpenShot
70+
Building ${PROJECT_NAME} (version ${PROJECT_VERSION})
71+
SO/API/ABI Version: ${SO_VERSION}
72+
")
6973

7074
#### Enable C++11 (for std::shared_ptr support)
71-
set(CMAKE_CXX_FLAGS "-std=c++11")
75+
set(CMAKE_CXX_STANDARD 11)
76+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
77+
set(CMAKE_CXX_EXTENSIONS OFF)
7278

7379
IF (WIN32)
7480
SET_PROPERTY(GLOBAL PROPERTY WIN32 "WIN32")

0 commit comments

Comments
 (0)