Permalink
Browse files

Merge branch 'master' of https://github.com/Eyescale/CMake into 1.4

  • Loading branch information...
2 parents ca98196 + 5b7a2d5 commit 114507e3082308c3b2f7f63b3ad89efa6c79152b @eile eile committed Jul 16, 2012
Showing with 40 additions and 126 deletions.
  1. +1 −1 CMake/Common.cmake
  2. +7 −106 CMake/FindCODASH.cmake
  3. +5 −0 CMake/FindCollage.cmake
  4. +21 −14 CMake/FindLibraryPackage.cmake
  5. +2 −4 CMake/FindMonsteer.cmake
  6. +4 −1 CMake/GitTargets.cmake
View
2 CMake/Common.cmake
@@ -62,7 +62,7 @@ if(CMAKE_COMPILER_IS_GNUCXX)
if(GCC_COMPILER_VERSION VERSION_LESS 4.1)
message(ERROR "GCC 4.1 or later required, found ${GCC_COMPILER_VERSION}")
endif()
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Winvalid-pch -Wnon-virtual-dtor -Wsign-promo -Wshadow -Winit-self -Wno-unknown-pragmas -Wno-unused-parameter -Wno-write-strings")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Winvalid-pch -Wnon-virtual-dtor -Wsign-promo -Wshadow -Winit-self -Wno-unknown-pragmas -Wno-unused-parameter")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wuninitialized")
set(CMAKE_CXX_FLAGS_DEBUG
"${CMAKE_CXX_FLAGS_DEBUG} -fprofile-arcs -ftest-coverage")
View
113 CMake/FindCODASH.cmake
@@ -63,113 +63,14 @@
#==================================
# Naming convention:
# Local variables of the form _codash_foo
-# Input variables of the form Dash_FOO
+# Input variables of the form Codash_FOO
# Output variables of the form CODASH_FOO
#
-#
-# find and parse codash/version.h
-find_path(_codash_INCLUDE_DIR codash/version.h
- HINTS ${CMAKE_SOURCE_DIR}/../../.. $ENV{CODASH_ROOT} ${CODASH_ROOT} }
- PATH_SUFFIXES include
- PATHS /usr /usr/local /opt/local /opt
- )
-
-if(CoDash_FIND_REQUIRED)
- set(_codash_version_output_type FATAL_ERROR)
-else()
- set(_codash_version_output_type STATUS)
-endif()
-
-# Try to ascertain the version...
-if(_codash_INCLUDE_DIR)
- set(_codash_Version_file "${_codash_INCLUDE_DIR}/codash/version.h")
-
- if(EXISTS "${_codash_Version_file}")
- file(READ "${_codash_Version_file}" _codash_Version_contents)
- else()
- set(_codash_Version_contents "unknown")
- endif()
-
- if(_codash_Version_contents MATCHES ".*define CODASH_VERSION_MAJOR[ \t]+([0-9]+).*")
- string(REGEX REPLACE ".*define CODASH_VERSION_MAJOR[ \t]+([0-9]+).*"
- "\\1" CODASH_VERSION_MAJOR ${_codash_Version_contents})
- string(REGEX REPLACE ".*define CODASH_VERSION_MINOR[ \t]+([0-9]+).*"
- "\\1" CODASH_VERSION_MINOR ${_codash_Version_contents})
- string(REGEX REPLACE ".*define CODASH_VERSION_PATCH[ \t]+([0-9]+).*"
- "\\1" CODASH_VERSION_PATCH ${_codash_Version_contents})
- set(CODASH_VERSION "${CODASH_VERSION_MAJOR}.${CODASH_VERSION_MINOR}.${CODASH_VERSION_PATCH}"
- CACHE INTERNAL "The version of CODASH which was detected")
- else()
- set(CODASH_VERSION "0.1.0"
- CACHE INTERNAL "The version of CODASH which was detected")
- endif()
-else()
- set(_codash_EPIC_FAIL TRUE)
- message(${_codash_version_output_type}
- "Can't find CODASH header file version.h.")
-endif()
-
-#
-# Version checking
-#
-if(CoDash_FIND_VERSION AND CODASH_VERSION)
- if(CoDash_FIND_VERSION_EXACT)
- if(NOT CODASH_VERSION VERSION_EQUAL ${CoDash_FIND_VERSION})
- set(_codash_version_not_exact TRUE)
- endif()
- else()
- # version is too low
- if(NOT CODASH_VERSION VERSION_EQUAL ${CoDash_FIND_VERSION} AND
- NOT CODASH_VERSION VERSION_GREATER ${CoDash_FIND_VERSION})
- set(_codash_version_not_high_enough TRUE)
- endif()
- endif()
-endif()
-
-find_library(_codash_LIBRARY codash
- HINTS ${CMAKE_SOURCE_DIR}/../../.. $ENV{CODASH_ROOT} ${CODASH_ROOT} }
- PATH_SUFFIXES lib
- PATHS /usr /usr/local /opt/local /opt
-)
-
-# Inform the users with an error message based on what version they
-# have vs. what version was required.
-if(_codash_version_not_high_enough)
- set(_codash_EPIC_FAIL TRUE)
- message(${_codash_version_output_type}
- "Version ${CoDash_FIND_VERSION} or higher of CODASH is required. "
- "Version ${CODASH_VERSION} was found in ${_codash_INCLUDE_DIR}.")
-elseif(_codash_version_not_exact)
- set(_codash_EPIC_FAIL TRUE)
- message(${_codash_version_output_type}
- "Version ${CoDash_FIND_VERSION} of CODASH is required exactly. "
- "Version ${CODASH_VERSION} was found.")
-else()
- if(CoDash_FIND_REQUIRED)
- if(_codash_LIBRARY MATCHES "_codash_LIBRARY-NOTFOUND")
- message(FATAL_ERROR "Missing the CODASH library.\n"
- "Consider using CMAKE_PREFIX_PATH or the CODASH_ROOT environment variable. "
- "See the ${CMAKE_CURRENT_LIST_FILE} for more details.")
- endif()
- endif()
- include(FindPackageHandleStandardArgs)
- FIND_PACKAGE_HANDLE_STANDARD_ARGS(CoDash DEFAULT_MSG
- _codash_LIBRARY _codash_INCLUDE_DIR)
-endif()
-
-if(_codash_EPIC_FAIL)
- # Zero out everything, we didn't meet version requirements
- set(CODASH_FOUND FALSE)
- set(_codash_LIBRARY)
- set(_codash_INCLUDE_DIR)
-endif()
-
-set(CODASH_INCLUDE_DIRS ${_codash_INCLUDE_DIR})
-set(CODASH_LIBRARIES ${_codash_LIBRARY})
-get_filename_component(CODASH_LIBRARY_DIR ${_codash_LIBRARY} PATH)
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/FindCODASH)
+include(FindLibraryPackage)
+include(FindPackageHandleStandardArgs)
-if(CODASH_FOUND)
- message(STATUS "Found CODASH ${CODASH_VERSION} in "
- "${CODASH_INCLUDE_DIRS};${CODASH_LIBRARIES}")
-endif()
+find_library_package(codash TRANSIENT Collage DASH)
+find_package_handle_standard_args(CODASH DEFAULT_MSG
+ CODASH_LIBRARIES CODASH_INCLUDE_DIRS)
View
5 CMake/FindCollage.cmake
@@ -75,6 +75,11 @@ set(_Collage_Lunchbox_version_0.5.1 "0.9.0")
set(_Collage_Lunchbox_version_0.5.2 "1.3.5")
set(_Collage_Lunchbox_version_0.5.5 "1.3.5")
+# needed if called directly w/o called from FindEqualizer
+if(NOT COLLAGE_ROOT)
+ set(COLLAGE_ROOT ${EQ_ROOT})
+endif()
+
find_library_package(Collage INCLUDE co TRANSIENT Lunchbox)
find_package_handle_standard_args(Collage DEFAULT_MSG
COLLAGE_LIBRARIES COLLAGE_INCLUDE_DIRS)
View
35 CMake/FindLibraryPackage.cmake
@@ -104,6 +104,9 @@ macro(FIND_LIBRARY_PACKAGE name)
endif()
string(TOUPPER ${_flp_${name}_INCLUDE} _flp_${name}_INCLUDE_UC)
+ # might already be set from a previous run with a different/wrong version
+ unset(${_flp_NAME}_INCLUDE_DIR CACHE)
+
find_path(${_flp_${name}_UC}_INCLUDE_DIR ${_flp_${name}_INCLUDE}/version.h
HINTS "${${_flp_${name}_UC}_ROOT}/include" "$ENV{${_flp_${name}_UC}_ROOT}/include"
PATHS /usr/include /usr/local/include /opt/local/include /opt/include)
@@ -131,34 +134,34 @@ macro(FIND_LIBRARY_PACKAGE name)
endif()
if(EXISTS "${_flp_Version_file}")
- file(READ "${_flp_Version_file}" _flp_Version_contents)
+ file(READ "${_flp_Version_file}" _flp_${name}_Version_contents)
else()
- set(_flp_Version_contents "unknown")
+ set(_flp_${name}_Version_contents "unknown")
endif()
# parse version out of version.h
string(REGEX MATCH "define[ \t]+${_flp_${name}_UC}_VERSION_MAJOR[ \t]+[0-9]+"
- ${_flp_${name}_UC}_VERSION_MAJOR ${_flp_Version_contents})
+ ${_flp_${name}_UC}_VERSION_MAJOR ${_flp_${name}_Version_contents})
string(REGEX MATCH "define[ \t]+${_flp_${name}_UC}_VERSION_MINOR[ \t]+[0-9]+"
- ${_flp_${name}_UC}_VERSION_MINOR ${_flp_Version_contents})
+ ${_flp_${name}_UC}_VERSION_MINOR ${_flp_${name}_Version_contents})
string(REGEX MATCH "define[ \t]+${_flp_${name}_UC}_VERSION_PATCH[ \t]+[0-9]+"
- ${_flp_${name}_UC}_VERSION_PATCH ${_flp_Version_contents})
+ ${_flp_${name}_UC}_VERSION_PATCH ${_flp_${name}_Version_contents})
string(REGEX MATCH "define[ \t]+${_flp_${name}_UC}_VERSION_ABI[ \t]+[0-9]+"
- ${_flp_${name}_UC}_VERSION_ABI ${_flp_Version_contents})
+ ${_flp_${name}_UC}_VERSION_ABI ${_flp_${name}_Version_contents})
if("${${_flp_${name}_UC}_VERSION_MAJOR}" STREQUAL "") # Try 'include' naming
string(REGEX MATCH
"define[ \t]+${_flp_${name}_INCLUDE_UC}_VERSION_MAJOR[ \t]+[0-9]+"
- ${_flp_${name}_UC}_VERSION_MAJOR ${_flp_Version_contents})
+ ${_flp_${name}_UC}_VERSION_MAJOR ${_flp_${name}_Version_contents})
string(REGEX MATCH
"define[ \t]+${_flp_${name}_INCLUDE_UC}_VERSION_MINOR[ \t]+[0-9]+"
- ${_flp_${name}_UC}_VERSION_MINOR ${_flp_Version_contents})
+ ${_flp_${name}_UC}_VERSION_MINOR ${_flp_${name}_Version_contents})
string(REGEX MATCH
"define[ \t]+${_flp_${name}_INCLUDE_UC}_VERSION_PATCH[ \t]+[0-9]+"
- ${_flp_${name}_UC}_VERSION_PATCH ${_flp_Version_contents})
+ ${_flp_${name}_UC}_VERSION_PATCH ${_flp_${name}_Version_contents})
string(REGEX MATCH
"define[ \t]+${_flp_${name}_INCLUDE_UC}_VERSION_ABI[ \t]+[0-9]+"
- ${_flp_${name}_UC}_VERSION_ABI ${_flp_Version_contents})
+ ${_flp_${name}_UC}_VERSION_ABI ${_flp_${name}_Version_contents})
endif()
if("${${_flp_${name}_UC}_VERSION_MAJOR}" STREQUAL "")
@@ -200,22 +203,22 @@ macro(FIND_LIBRARY_PACKAGE name)
string(REGEX MATCH
"define[ \t]+${_flp_${name}_UC}_${_flp_${name}_TRANS}_VERSION[ \t]+[0-9.]+"
${_flp_${name}_UC}_${_flp_${name}_TRANS}_VERSION
- ${_flp_Version_contents})
+ ${_flp_${name}_Version_contents})
# not found -> search 'CO_LUNCHBOX_VERSION'
if("${${_flp_${name}_UC}_${_flp_${name}_TRANS}_VERSION}" STREQUAL "")
string(REGEX MATCH
"define[ \t]+${_flp_${name}_INCLUDE_UC}_${_flp_${name}_TRANS}_VERSION[ \t]+[0-9.]+"
${_flp_${name}_UC}_${_flp_${name}_TRANS}_VERSION
- ${_flp_Version_contents})
+ ${_flp_${name}_Version_contents})
endif()
# not found -> use _Collage_Lunchbox_version_${CO_VERSION}
if("${${_flp_${name}_UC}_${_flp_${name}_TRANS}_VERSION}" STREQUAL "")
set(${_flp_${name}_UC}_${_flp_${name}_TRANS}_VERSION
${_${name}_${_flp_trans}_version_${${_flp_${name}_UC}_VERSION}})
endif()
-
+
if(${_flp_${name}_UC}_${_flp_${name}_TRANS}_VERSION)
string(REGEX REPLACE ".*[ \t]([0-9.]+)" "\\1"
${_flp_${name}_UC}_${_flp_${name}_TRANS}_VERSION
@@ -226,7 +229,11 @@ macro(FIND_LIBRARY_PACKAGE name)
if(NOT ${_flp_${name}_TRANS}_FOUND)
set(_flp_${name}_FAIL TRUE)
endif()
- # else() no version, don't search for package
+ else()
+ message(WARNING
+ "Can't figure out version of dependent package ${_flp_trans}, "
+ "add ${_flp_${name}_UC}_${_flp_${name}_TRANS}_VERSION to "
+ "${_flp_${name}_INCLUDE}/version.h.")
endif()
endforeach()
else()
View
6 CMake/FindMonsteer.cmake
@@ -71,9 +71,7 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/FindMonsteer)
include(FindLibraryPackage)
include(FindPackageHandleStandardArgs)
-find_library_package(Monsteer INCLUDE monsteer)
+find_library_package(Monsteer INCLUDE monsteer TRANSIENT Collage DASH
+ CODASH Lunchbox)
find_package_handle_standard_args(Monsteer DEFAULT_MSG
MONSTEER_LIBRARIES MONSTEER_INCLUDE_DIRS)
-if(MONSTEER_FOUND)
- include("${MONSTEER_LIBRARY_DIRS}/../share/Monsteer/CMake/options.cmake")
-endif()
View
5 CMake/GitTargets.cmake
@@ -1,7 +1,10 @@
# Copyright (c) 2012 Stefan.Eilemann@epfl.ch
# See doc/GitTargets.md for documentation
-find_package(Git REQUIRED)
+find_package(Git)
+if(NOT GIT_EXECUTABLE)
+ return()
+endif()
math(EXPR _gittargets_ODD_MINOR "${VERSION_MINOR} % 2")
if(_gittargets_ODD_MINOR)

0 comments on commit 114507e

Please sign in to comment.