@@ -533,26 +533,6 @@ configure_file (src/glog/raw_logging.h.in glog/raw_logging.h @ONLY)
533
533
configure_file (src/glog/stl_logging.h.in glog/stl_logging.h @ONLY)
534
534
configure_file (src/glog/vlog_is_on.h.in glog/vlog_is_on.h @ONLY)
535
535
536
- if (WITH_PKGCONFIG)
537
- set (VERSION ${PROJECT_VERSION} )
538
- set (prefix ${CMAKE_INSTALL_PREFIX} )
539
- set (exec_prefix ${CMAKE_INSTALL_FULL_BINDIR} )
540
- set (libdir ${CMAKE_INSTALL_FULL_LIBDIR} )
541
- set (includedir ${CMAKE_INSTALL_FULL_INCLUDEDIR} )
542
-
543
- configure_file (
544
- "${PROJECT_SOURCE_DIR} /libglog.pc.in"
545
- "${PROJECT_BINARY_DIR} /libglog.pc"
546
- @ONLY
547
- )
548
-
549
- unset (VERSION )
550
- unset (prefix )
551
- unset (exec_prefix)
552
- unset (libdir)
553
- unset (includedir)
554
- endif (WITH_PKGCONFIG)
555
-
556
536
add_compile_options ($<$<AND :$<BOOL :${HAVE_NO_UNNAMED_TYPE_TEMPLATE_ARGS} >,$<NOT :$<CXX_COMPILER_ID:GNU>>>:-Wno-unnamed-type -template-args>)
557
537
558
538
set (_glog_CMake_BINDIR ${CMAKE_INSTALL_BINDIR} )
@@ -641,17 +621,25 @@ add_library (glog
641
621
642
622
add_library (glog::glog ALIAS glog)
643
623
624
+ set (glog_libraries_options_for_static_linking)
625
+
644
626
if (Unwind_FOUND)
645
627
target_link_libraries (glog PRIVATE unwind::unwind)
628
+ set (glog_libraries_options_for_static_linking "${glog_libraries_options_for_static_linking} -lunwind" )
646
629
set (Unwind_DEPENDENCY "find_dependency (Unwind ${Unwind_VERSION} )" )
647
630
endif (Unwind_FOUND)
648
631
649
632
if (HAVE_DBGHELP)
650
633
target_link_libraries (glog PRIVATE dbghelp)
634
+ set (glog_libraries_options_for_static_linking "${glog_libraries_options_for_static_linking} -ldbghelp" )
651
635
endif (HAVE_DBGHELP)
652
636
653
637
if (HAVE_PTHREAD)
654
638
target_link_libraries (glog PRIVATE ${CMAKE_THREAD_LIBS_INIT} )
639
+
640
+ if (CMAKE_THREAD_LIBS_INIT)
641
+ set (glog_libraries_options_for_static_linking "${glog_libraries_options_for_static_linking} ${CMAKE_THREAD_LIBS_INIT} " )
642
+ endif (CMAKE_THREAD_LIBS_INIT)
655
643
endif (HAVE_PTHREAD)
656
644
657
645
if (gflags_FOUND)
@@ -662,6 +650,8 @@ if (gflags_FOUND)
662
650
target_link_libraries (glog PUBLIC gflags)
663
651
endif (TARGET gflags::gflags)
664
652
653
+ set (glog_libraries_options_for_static_linking "${glog_libraries_options_for_static_linking} -lgflags" )
654
+
665
655
target_compile_definitions (glog PRIVATE
666
656
GFLAGS_DLL_DECLARE_FLAG=GOOGLE_GLOG_DLL_DECL
667
657
GFLAGS_DLL_DEFINE_FLAG=GOOGLE_GLOG_DLL_DECL
@@ -670,6 +660,7 @@ endif (gflags_FOUND)
670
660
671
661
if (ANDROID)
672
662
target_link_libraries (glog PRIVATE log )
663
+ set (glog_libraries_options_for_static_linking "${glog_libraries_options_for_static_linking} -llog" )
673
664
endif (ANDROID)
674
665
675
666
set_target_properties (glog PROPERTIES VERSION ${PROJECT_VERSION} )
@@ -714,6 +705,28 @@ generate_export_header (glog
714
705
EXPORT_MACRO_NAME GOOGLE_GLOG_DLL_DECL
715
706
EXPORT_FILE_NAME ${CMAKE_CURRENT_BINARY_DIR} /glog/export.h)
716
707
708
+ string (STRIP "${glog_libraries_options_for_static_linking} " glog_libraries_options_for_static_linking)
709
+
710
+ if (WITH_PKGCONFIG)
711
+ set (VERSION ${PROJECT_VERSION} )
712
+ set (prefix ${CMAKE_INSTALL_PREFIX} )
713
+ set (exec_prefix ${CMAKE_INSTALL_FULL_BINDIR} )
714
+ set (libdir ${CMAKE_INSTALL_FULL_LIBDIR} )
715
+ set (includedir ${CMAKE_INSTALL_FULL_INCLUDEDIR} )
716
+
717
+ configure_file (
718
+ "${PROJECT_SOURCE_DIR} /libglog.pc.in"
719
+ "${PROJECT_BINARY_DIR} /libglog.pc"
720
+ @ONLY
721
+ )
722
+
723
+ unset (VERSION )
724
+ unset (prefix )
725
+ unset (exec_prefix)
726
+ unset (libdir)
727
+ unset (includedir)
728
+ endif (WITH_PKGCONFIG)
729
+
717
730
# Unit testing
718
731
719
732
if (BUILD_TESTING)
0 commit comments