Skip to content

Commit

Permalink
Merge pull request #5 from erikzenker/dev
Browse files Browse the repository at this point in the history
Config and Version CMake File
  • Loading branch information
slizzered committed Oct 14, 2015
2 parents 32828e7 + c6b495e commit 19f7032
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 50 deletions.
51 changes: 8 additions & 43 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,60 +1,25 @@
project(PROGRESSBAR_FOR_A_MORE_CIVILIZED_AGE)
cmake_minimum_required(VERSION 2.8.5)
project(elegant-progressbars-dev)
cmake_minimum_required(VERSION 3.0.2)


###############################################################################
# Using Clang is awesome
# code based on http://stackoverflow.com/q/7031126
# Compiler flags
###############################################################################
option(USE_CLANG "build application with clang" ON) # OFF is the default
option(CMAKE_BUILD_TYPE "build type" Slow) # to show the progress
if(USE_CLANG)
SET (CMAKE_C_COMPILER "/usr/bin/clang")
SET (CMAKE_C_FLAGS "-Wall -Wextra -std=c99")
SET (CMAKE_C_FLAGS_DEBUG "-g")
SET (CMAKE_C_FLAGS_MINSIZEREL "-Os -DNDEBUG")
SET (CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG")
SET (CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g")
SET (CMAKE_C_FLAGS_SLOW "-O0")

SET (CMAKE_CXX_COMPILER "/usr/bin/clang++")
SET (CMAKE_CXX_FLAGS "-Wall -Wextra -std=c++11")
SET (CMAKE_CXX_FLAGS_DEBUG "-g")
SET (CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG")
SET (CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")
SET (CMAKE_CXX_FLAGS_SLOW "-O0")
else(USE_CLANG)
SET (CMAKE_C_COMPILER "/usr/bin/gcc")
SET (CMAKE_C_FLAGS "-Wall -Wextra -std=c99")
SET (CMAKE_C_FLAGS_DEBUG "-g")
SET (CMAKE_C_FLAGS_MINSIZEREL "-Os -DNDEBUG")
SET (CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG")
SET (CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g")
SET (CMAKE_C_FLAGS_SLOW "-O0")

SET (CMAKE_CXX_COMPILER "/usr/bin/g++")
SET (CMAKE_CXX_FLAGS "-Wall -Wextra -std=c++11")
SET (CMAKE_CXX_FLAGS_DEBUG "-g")
SET (CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG")
SET (CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")
SET (CMAKE_CXX_FLAGS_SLOW "-O0")
endif(USE_CLANG)

SET (CMAKE_CXX_FLAGS "-Wall -Wextra -std=c++11")
SET (CMAKE_CXX_FLAGS_SLOW "-O0")


###############################################################################
# Headers
# Progressbar for a More Civilized Age Config
###############################################################################
# for header-only libraries, this is enough :)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
find_package(elegant-progressbars 1.0.0 REQUIRED PATHS "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")


###############################################################################
# Build executables
###############################################################################
add_executable(ProgressBarExample examples/progressbar_example.cc)
add_executable(ProgressBarExample examples/progressbar_example.cpp)

###############################################################################
# Custom targets
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ offer a legacy-variant, which is very nice of them).

Installation
------------

###Manual###
Just put the folder ./lib/elegantProgressbars in a place where your compiler
will find it when searching for libraries to include.

Expand All @@ -19,6 +21,13 @@ doxygen Doxyfile
firefox doc/html/index.html
```

###CMake Supported###

Clone the project to some local path and add the following line to your `CMakeLists.txt`:

find_package(elegant-progressbars PATHS "<ABSOLUTE-PATH-TO-ELEGANT-PROGRESSBAR>/cmake")


Example
-------
There is an example which can be compiled and tested:
Expand Down
5 changes: 5 additions & 0 deletions cmake/elegant-progressbarsConfig.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# - Config file for the progressbar-for-a-more-civilized-age package
cmake_minimum_required(VERSION 3.0.2)
project(elegant-progressbars)

include_directories("${elegant-progressbars_DIR}/../include")
26 changes: 26 additions & 0 deletions cmake/elegant-progressbarsConfigVersion.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
file(STRINGS "${CMAKE_CURRENT_LIST_DIR}/../include/elegantProgressbars/version.hpp" elegantProgressbars_VERSION_MAJOR_HPP REGEX "#define ELEGANTPROGRESSBARS_VERSION_MAJOR ")
file(STRINGS "${CMAKE_CURRENT_LIST_DIR}/../include/elegantProgressbars/version.hpp" elegantProgressbars_VERSION_MINOR_HPP REGEX "#define ELEGANTPROGRESSBARS_VERSION_MINOR ")
file(STRINGS "${CMAKE_CURRENT_LIST_DIR}/../include/elegantProgressbars/version.hpp" elegantProgressbars_VERSION_PATCH_HPP REGEX "#define ELEGANTPROGRESSBARS_VERSION_PATCH ")

string(REGEX MATCH "([0-9]+)" elegantProgressbars_VERSION_MAJOR ${elegantProgressbars_VERSION_MAJOR_HPP})
string(REGEX MATCH "([0-9]+)" elegantProgressbars_VERSION_MINOR ${elegantProgressbars_VERSION_MINOR_HPP})
string(REGEX MATCH "([0-9]+)" elegantProgressbars_VERSION_PATCH ${elegantProgressbars_VERSION_PATCH_HPP})

set(PACKAGE_VERSION "${elegantProgressbars_VERSION_MAJOR}.${elegantProgressbars_VERSION_MINOR}.${elegantProgressbars_VERSION_PATCH}")

# Check whether the requested PACKAGE_FIND_VERSION is exactly the one requested
if("${PACKAGE_VERSION}" EQUAL "${PACKAGE_FIND_VERSION}")
set(PACKAGE_VERSION_EXACT TRUE)
else()
set(PACKAGE_VERSION_EXACT FALSE)
endif()

# Check whether the requested PACKAGE_FIND_VERSION is compatible
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
set(PACKAGE_VERSION_COMPATIBLE TRUE)
if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
set(PACKAGE_VERSION_EXACT TRUE)
endif()
endif()
File renamed without changes.
5 changes: 5 additions & 0 deletions include/elegantProgressbars/version.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#pragma once

#define ELEGANTPROGRESSBARS_VERSION_MAJOR 1
#define ELEGANTPROGRESSBARS_VERSION_MINOR 0
#define ELEGANTPROGRESSBARS_VERSION_PATCH 0
7 changes: 0 additions & 7 deletions include/version.hpp

This file was deleted.

0 comments on commit 19f7032

Please sign in to comment.