Windows 10上源码编译glog和gflags 编写glog-config.cmake和gflags-config.cmake

本文首发于个人博客https://kezunlin.me/post/bb64e398/,欢迎阅读!

compile glog v0.3.5 and glags on windows from source.

Series

  • compile glog and glags on windows
  • compile glog and glags on ubuntu 16.04

Guide

version

  • glog: v0.3.5 https://github.com/google/glog/archive/v0.3.5.zip
  • gflag: v2.2.1 https://github.com/schuhschuh/gflags/archive/v2.2.1.zip

gflags

do not use offical version,instead use https://github.com/schuhschuh/gflags.git

    git clone https://github.com/schuhschuh/gflags.git 
    cd gflags
    mkdir windows-build
    cd windows-build
    cmake-gui ..

with options

    BUILD_SHARED_LIBS ON 
    INSTALL_SHARED_LIBS ON
    INSTALL_STATIC_LIBS OFF
    CMAKE_CONFIGURATION_TYPES Release # Release
    REGISTER_INSTALL_PREFIX OFF
    CMAKE_INSTALL_PREFIX D:/gflags
    #NAMESPACE google;gflags
    NAMESPACE google

or command

        cmake -DGFLAGS_NAMESPACE=google -DCMAKE_CXX_FLAGS=-fPIC ..

we get include and lib/gflags.lib, and bin/gflags.dll

modify CMAKE/CMAKE_INSTALL_PREFIX to a non-system folder, otherwise you will need administrative privileges

你可能感兴趣的:(kezunlin.me)