forked from google/glog
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request google#82 from sergiud/cmake-imported-target
Better support and documentation for CMake projects that consume glog
- Loading branch information
Showing
3 changed files
with
39 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
Building Glog with CMake | ||
======================== | ||
|
||
1. Create a build directory and `cd` to it. | ||
2. Run | ||
```bash | ||
cmake path/to/glog | ||
``` | ||
|
||
3. Afterwards, generated files (GNU make, Visual Studio, etc.) can be used to | ||
compile the project. | ||
|
||
|
||
Consuming Glog in a CMake Project | ||
================================= | ||
|
||
To use Glog in your project `myproj`, use: | ||
|
||
```cmake | ||
cmake_minimum_required (VERSION 3.0) | ||
project (myproj) | ||
find_package (glog 0.3.4 REQUIRED) | ||
add_executable (myapp main.cpp) | ||
target_link_libraries (myapp glog::glog) | ||
``` | ||
|
||
Compile definitions and options will be added automatically to your target as | ||
needed. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,7 @@ | ||
@PACKAGE_INIT@ | ||
|
||
include ("${CMAKE_CURRENT_LIST_DIR}/glog-targets.cmake") | ||
set_and_check (glog_INCLUDE_DIR "@PACKAGE_glog_INCLUDE_DIR@") | ||
|
||
@glog_PACKAGE_DEPS@ | ||
include (CMakeFindDependencyMacro) | ||
|
||
set (glog_LIBRARY glog) | ||
@gflags_DEPENDENCY@ | ||
|
||
set (glog_LIBRARIES ${glog_LIBRARY}) | ||
set (glog_INCLUDE_DIRS ${glog_INCLUDE_DIR}) | ||
include ("${CMAKE_CURRENT_LIST_DIR}/glog-targets.cmake") |