1 # WRITE_BASIC_CONFIG_VERSION_FILE( filename VERSION major.minor.patch COMPATIBILITY (AnyNewerVersion|SameMajorVersion) )
3 # Deprecated, see WRITE_BASIC_PACKAGE_VERSION_FILE(), it is identical.
5 #=============================================================================
6 # Copyright 2008-2011 Alexander Neundorf, <neundorf@kde.org>
7 # Copyright 2004-2009 Kitware, Inc.
9 # Distributed under the OSI-approved BSD License (the "License");
10 # see accompanying file Copyright.txt for details.
12 # This software is distributed WITHOUT ANY WARRANTY; without even the
13 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 # See the License for more information.
15 #=============================================================================
16 # (To distribute this file outside of CMake, substitute the full
17 # License text for the above reference.)
19 include(CMakeParseArguments)
21 function(WRITE_BASIC_CONFIG_VERSION_FILE _filename)
24 set(oneValueArgs VERSION COMPATIBILITY )
27 cmake_parse_arguments(CVF "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
29 if(CVF_UNPARSED_ARGUMENTS)
30 message(FATAL_ERROR "Unknown keywords given to WRITE_BASIC_CONFIG_VERSION_FILE(): \"${CVF_UNPARSED_ARGUMENTS}\"")
33 set(versionTemplateFile "${CMAKE_ROOT}/Modules/BasicConfigVersion-${CVF_COMPATIBILITY}.cmake.in")
34 if(NOT EXISTS "${versionTemplateFile}")
35 message(FATAL_ERROR "Bad COMPATIBILITY value used for WRITE_BASIC_CONFIG_VERSION_FILE(): \"${CVF_COMPATIBILITY}\"")
38 if("${CVF_VERSION}" STREQUAL "")
39 message(FATAL_ERROR "No VERSION specified for WRITE_BASIC_CONFIG_VERSION_FILE()")
42 configure_file("${versionTemplateFile}" "${_filename}" @ONLY)