Files
ortools-clone/patches/glog.patch
Corentin Le Molgat 6a9584794a Update export to ortoolsTargets.cmake
- Use export in Cbc (master)
- Patch Protobuf to work
- Remove glog patch which disable install(export ...)
2018-02-06 14:18:08 +01:00

98 lines
3.3 KiB
Diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5739702..ce78f55 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,3 +1,26 @@
+## CMake configuration file of glog project
+##
+## When this project is a subproject. The "glog::glog" target is in this case
+## an ALIAS library target for the "glog" library target. Targets which depend
+## on the glog library should link to the "glog::glog" library target.
+##
+## Example CMakeLists.txt of user project which requires separate glog installation:
+## cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
+## project(Foo)
+##
+## find_package(glog REQUIRED)
+##
+## add_executable(foo src/foo.cc)
+## target_link_libraries(foo glog::glog)
+##
+## Example CMakeLists.txt of super-project which contains glog source tree:
+## cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
+## project(Foo)
+##
+## add_subdirectory(glog)
+##
+## add_executable(foo src/foo.cc)
+## target_link_libraries(foo glog::glog)
cmake_minimum_required (VERSION 3.0)
if (POLICY CMP0042)
@@ -8,23 +31,14 @@ if (POLICY CMP0063)
cmake_policy (SET CMP0063 NEW)
endif (POLICY CMP0063)
-project (glog)
-
-enable_testing ()
-
-set (GLOG_MAJOR_VERSION 0)
-set (GLOG_MINOR_VERSION 3)
-set (GLOG_PATCH_VERSION 5)
-
-set (GLOG_VERSION
- ${GLOG_MAJOR_VERSION}.${GLOG_MINOR_VERSION}.${GLOG_PATCH_VERSION})
+project(glog VERSION 0.3.5 LANGUAGES C CXX)
set (CPACK_PACKAGE_NAME glog)
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "")
-set (CPACK_PACKAGE_VERSION_MAJOR ${GLOG_MAJOR_VERSION})
-set (CPACK_PACKAGE_VERSION_MINOR ${GLOG_MINOR_VERSION})
-set (CPACK_PACKAGE_VERSION_PATCH ${GLOG_PATCH_VERSION})
-set (CPACK_PACKAGE_VERSION ${GLOG_VERSION})
+set (CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
+set (CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
+set (CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
+set (CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
option (WITH_GFLAGS "Use gflags" ON)
option (WITH_THREADS "Enable multithreading support" ON)
@@ -409,6 +423,7 @@ add_compile_options ($<$<BOOL:${HAVE_NO_UNNAMED_TYPE_TEMPLATE_ARGS}>:-Wno-unname
add_library (glog
${GLOG_SRCS}
)
+add_library(glog::glog ALIAS glog)
set_target_properties (glog PROPERTIES POSITION_INDEPENDENT_CODE ON)
@@ -426,7 +441,7 @@ if (WIN32 AND HAVE_SNPRINTF)
endif (WIN32 AND HAVE_SNPRINTF)
if (gflags_FOUND)
- target_link_libraries (glog PUBLIC gflags)
+ target_link_libraries (glog PUBLIC gflags::gflags)
if (NOT BUILD_SHARED_LIBS)
# Don't use __declspec(dllexport|dllimport) if this is a static build
@@ -434,8 +449,8 @@ if (gflags_FOUND)
endif (NOT BUILD_SHARED_LIBS)
endif (gflags_FOUND)
-set_target_properties (glog PROPERTIES VERSION ${GLOG_MAJOR_VERSION})
-set_target_properties (glog PROPERTIES SOVERSION ${GLOG_VERSION})
+set_target_properties (glog PROPERTIES VERSION ${PROJECT_VERSION})
+set_target_properties (glog PROPERTIES SOVERSION ${PROJECT_VERSION_MAJOR})
if (WIN32)
target_compile_definitions (glog PUBLIC GLOG_NO_ABBREVIATED_SEVERITIES)
@@ -619,7 +634,7 @@ configure_package_config_file (glog-config.cmake.in
NO_CHECK_REQUIRED_COMPONENTS_MACRO)
write_basic_package_version_file (glog-config-version.cmake VERSION
- ${GLOG_VERSION} COMPATIBILITY SameMajorVersion)
+ ${PROJECT_VERSION} COMPATIBILITY SameMajorVersion)
export (TARGETS glog NAMESPACE glog:: FILE glog-targets.cmake)
export (PACKAGE glog)