diff --git a/CMakeLists.txt b/CMakeLists.txt index 5ee79cf..1b59690 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,93 +1,99 @@ #=============================================================================== # @file CMakeLists.txt # # @author Guillaume Anciaux # # @date Thu Oct 11 12:43:10 2012 # # @brief main configuration file # # @section LICENSE # # Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # #=============================================================================== #=============================================================================== # CMake Project #=============================================================================== cmake_minimum_required(VERSION 2.6) project(IOHelper) enable_language(CXX) set(IOHelper_MAJOR_VERSION 0) set(IOHelper_MINOR_VERSION 1) #=============================================================================== # Misc. #=============================================================================== set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared libraries.") find_package (ZLIB) if(ZLIB_FOUND) set (IOHELPER_EXTERNAL_LIBS ${IOHELPER_EXTERNAL_LIBS} ${ZLIB_LIBRARIES}) include_directories(${ZLIB_INCLUDE_DIRS}) endif() #=============================================================================== # Version Number #=============================================================================== # IOHelper version number. An even minor number corresponds to releases. execute_process(COMMAND ./get_revision.sh WORKING_DIRECTORY ${IOHelper_SOURCE_DIR} OUTPUT_VARIABLE IOHelper_BUILD_VERSION) -string(STRIP ${IOHelper_BUILD_VERSION} IOHelper_BUILD_VERSION) +if(IOHelper_BUILD_VERSION) + string(STRIP ${IOHelper_BUILD_VERSION} IOHelper_BUILD_VERSION) -set(IOHelper_VERSION - "${IOHelper_MAJOR_VERSION}.${IOHelper_MINOR_VERSION}.${IOHelper_BUILD_VERSION}" - ) + set(IOHelper_VERSION + "${IOHelper_MAJOR_VERSION}.${IOHelper_MINOR_VERSION}.${IOHelper_BUILD_VERSION}" + ) +else() + set(IOHelper_VERSION + "${IOHelper_MAJOR_VERSION}.${IOHelper_MINOR_VERSION}" + ) +endif() # Append the library version information to the library target properties if(NOT IOHelper_NO_LIBRARY_VERSION) set(IOHelper_LIBRARY_PROPERTIES ${IOHelper_LIBRARY_PROPERTIES} VERSION "${IOHelper_VERSION}" SOVERSION "${IOHelper_MAJOR_VERSION}.${IOHelper_MINOR_VERSION}" ) endif(NOT IOHelper_NO_LIBRARY_VERSION) #============================================================================== # Library #=============================================================================== add_subdirectory(src) #============================================================================== # Packaging #=============================================================================== include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/IOHelperCPack.cmake) #=============================================================================== # Tests #=============================================================================== option(IOHELPER_TESTS "Activate tests" OFF) if(IOHELPER_TESTS) enable_testing() include(CTest) add_subdirectory(test) endif() \ No newline at end of file