Files
ortools-clone/patches/gflags.patch
Corentin Le Molgat ebcdeb0e20 add version to gflags
2018-02-06 14:16:37 +01:00

78 lines
3.0 KiB
Diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3709073..59bfcb0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -14,9 +14,9 @@
##
## When this project is a subproject (GFLAGS_IS_SUBPROJECT is TRUE), the default
## settings are such that only the static single-threaded library is built without
-## installation of the gflags files. The "gflags" target is in this case an ALIAS
+## installation of the gflags files. The "gflags::gflags" target is in this case an ALIAS
## library target for the "gflags_nothreads_static" library target. Targets which
-## depend on the gflags library should link to the "gflags" library target.
+## depend on the gflags library should link to the "gflags::gflags" library target.
##
## Example CMakeLists.txt of user project which requires separate gflags installation:
## cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
@@ -26,7 +26,7 @@
## find_package(gflags REQUIRED)
##
## add_executable(foo src/foo.cc)
-## target_link_libraries(foo gflags)
+## target_link_libraries(foo gflags::gflags)
##
## Example CMakeLists.txt of user project which requires separate single-threaded static gflags installation:
## cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
@@ -36,7 +36,7 @@
## find_package(gflags COMPONENTS nothreads_static)
##
## add_executable(foo src/foo.cc)
-## target_link_libraries(foo gflags)
+## target_link_libraries(foo gflags::gflags)
##
## Example CMakeLists.txt of super-project which contains gflags source tree:
## cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
@@ -46,7 +46,7 @@
## add_subdirectory(gflags)
##
## add_executable(foo src/foo.cc)
-## target_link_libraries(foo gflags)
+## target_link_libraries(foo gflags::gflags)
##
## Variables to configure the source files:
## - GFLAGS_IS_A_DLL
@@ -76,6 +76,10 @@ if (POLICY CMP0042)
cmake_policy (SET CMP0042 NEW)
endif ()
+if (POLICY CMP0048)
+ cmake_policy (SET CMP0048 NEW)
+endif ()
+
# ----------------------------------------------------------------------------
# includes
include ("${CMAKE_CURRENT_SOURCE_DIR}/cmake/utils.cmake")
@@ -90,7 +94,7 @@ set (PACKAGE_BUGREPORT "https://github.com/gflags/gflags/issues")
set (PACKAGE_DESCRIPTION "A commandline flags library that allows for distributed flags.")
set (PACKAGE_URL "http://gflags.github.io/gflags")
-project (${PACKAGE_NAME} CXX)
+project (${PACKAGE_NAME} VERSION ${PACKAGE_VERSION} LANGUAGES CXX)
if (CMAKE_VERSION VERSION_LESS 3.4)
# C language still needed because the following required CMake modules
# (or their dependencies, respectively) are not correctly handling
@@ -490,11 +494,11 @@ if (GFLAGS_IS_SUBPROJECT)
foreach (type IN ITEMS static shared)
foreach (opts IN ITEMS "_nothreads" "")
if (TARGET gflags${opts}_${type})
- add_library (gflags ALIAS gflags${opts}_${type})
+ add_library (gflags::gflags ALIAS gflags${opts}_${type})
break ()
endif ()
endforeach ()
- if (TARGET gflags)
+ if (TARGET gflags::gflags)
break ()
endif ()
endforeach ()