Squashed 'libs/EXTERNAL/libezgl/' changes from fdc2113c2..6fb7c27cd
6fb7c27cd Merge pull request #9 from kmurray/non_root_build_fix
86fbdbbd6 Merge pull request #10 from kmurray/bump_example_cmake_version
a04d2c877 Bump CMake version for example program
19b2118c8 Fix non-root project variable condition
59ad0ff1a Merge pull request #8 from kmurray/non_primary_project_build
b9a057bab Merge pull request #7 from kmurray/system_includes
98fe682f1 Merge pull request #6 from kmurray/bump_cmake_version
a65dd9fd8 Do not build examples by default if EZGL is non-root cmake project
77cbb92e5 Treat GTK/X11 as system includes
4376ef214 Bump CMake version to 3.9
git-subtree-dir: libs/EXTERNAL/libezgl
git-subtree-split: 6fb7c27cd681869744e84745bca21dcb02f6f4b3
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8b157e7..164887e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,4 @@
-# require at least CMake version 3.0.2
-cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR)
+cmake_minimum_required(VERSION 3.9 FATAL_ERROR)
# create the project
project(
@@ -21,6 +20,12 @@
# a set of macros has been developed by Makman2 on GitHub to help with this
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/gcr-cmake/macros)
+#Is ezgl the root cmake project?
+set(IS_ROOT_PROJECT TRUE)
+if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
+ set(IS_ROOT_PROJECT FALSE)
+endif()
+
# include the configuration/compile time options for this library
include(options.cmake)
@@ -47,6 +52,13 @@
target_include_directories(
${PROJECT_NAME}
PUBLIC include
+)
+
+#Treat GTK/X11 headers as system headers so they
+#do not generate compilation warnings
+target_include_directories(
+ ${PROJECT_NAME}
+ SYSTEM
PUBLIC ${GTK3_INCLUDE_DIRS}
PUBLIC ${X11_INCLUDE_DIRS}
)
diff --git a/examples/basic-application/CMakeLists.txt b/examples/basic-application/CMakeLists.txt
index 4b8c8b0..42d1c0e 100644
--- a/examples/basic-application/CMakeLists.txt
+++ b/examples/basic-application/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR)
+cmake_minimum_required(VERSION 3.9 FATAL_ERROR)
project(
basic-application
diff --git a/options.cmake b/options.cmake
index d8cd220..59f85db 100644
--- a/options.cmake
+++ b/options.cmake
@@ -1,7 +1,7 @@
option(
EZGL_BUILD_EXAMPLES
"Build the EZGL example executables."
- ON
+ ${IS_ROOT_PROJECT} #Only build examples by default if EZGL is the root cmake project
)
option(