Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tools/mkunity/CMakeLists.txt:
- # Icinga 2
- # Copyright (C) 2012-2015 Icinga Development Team (http://www.icinga.org)
- #
- # This program is free software; you can redistribute it and/or
- # modify it under the terms of the GNU General Public License
- # as published by the Free Software Foundation; either version 2
- # of the License, or (at your option) any later version.
- #
- # This program 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 General Public License for more details.
- #
- # You should have received a copy of the GNU General Public License
- # along with this program; if not, write to the Free Software Foundation
- # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
- define_property(
- SOURCE
- PROPERTY EXCLUDE_UNITY_BUILD
- BRIEF_DOCS "Whether to exclude the source file from unity builds"
- FULL_DOCS "Specified whether a source file should be excluded from unity builds and should be built separately"
- )
- if(ICINGA2_UNITY_BUILD)
- if(CMAKE_CROSSCOMPILING)
- set(IMPORT_EXECUTABLES "IMPORTFILE-NOTFOUND" CACHE FILEPATH "Point it to the export file from a native build")
- include(${IMPORT_EXECUTABLES})
- endif(CMAKE_CROSSCOMPILING)
- if(NOT CMAKE_CROSSCOMPILING)
- add_executable(mkunity mkunity.c)
- set_target_properties (
- mkunity PROPERTIES
- FOLDER Bin
- )
- export(TARGETS mkunity APPEND FILE ${CMAKE_BINARY_DIR}/ImportExecutables.cmake )
- endif(NOT CMAKE_CROSSCOMPILING)
- function(MKUNITY_TARGET Prefix UnityInputRef)
- set(UnityInput ${${UnityInputRef}})
- set(UnityOutput ${CMAKE_CURRENT_BINARY_DIR}/${Prefix}_unity.cpp)
- set(RealSources "")
- set(UnitySources "")
- foreach(UnitySource ${UnityInput})
- get_property(SourceExcluded SOURCE ${UnitySource} PROPERTY EXCLUDE_UNITY_BUILD)
- if(SourceExcluded MATCHES TRUE OR NOT ${UnitySource} MATCHES "\\.(cpp|cxx|cc)\$")
- list(APPEND RealSources ${UnitySource})
- else()
- list(APPEND UnitySources ${UnitySource})
- endif()
- endforeach()
- add_custom_command(
- OUTPUT ${UnityOutput}
- COMMAND mkunity
- ARGS ${Prefix} ${UnitySources} > ${UnityOutput}.tmp
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy ${UnityOutput}.tmp ${UnityOutput}
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- DEPENDS mkunity ${UnityInput}
- )
- list(APPEND RealSources ${UnityOutput})
- set(${UnityInputRef} ${RealSources} PARENT_SCOPE)
- endfunction()
- endif()
- --------------------------------------------------------------------------------------
- ImportExecutables.txt
- # Generated by CMake 3.0.2
- if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.5)
- message(FATAL_ERROR "CMake >= 2.6.0 required")
- endif()
- cmake_policy(PUSH)
- cmake_policy(VERSION 2.6)
- #----------------------------------------------------------------
- # Generated CMake target import file.
- #----------------------------------------------------------------
- # Commands may need to know the format version.
- set(CMAKE_IMPORT_FILE_VERSION 1)
- # Protect against multiple inclusion, which would fail when already imported targets are added once more.
- set(_targetsDefined)
- set(_targetsNotDefined)
- set(_expectedTargets)
- foreach(_expectedTarget mkclass mkembedconfig mkunity)
- list(APPEND _expectedTargets ${_expectedTarget})
- if(NOT TARGET ${_expectedTarget})
- list(APPEND _targetsNotDefined ${_expectedTarget})
- endif()
- if(TARGET ${_expectedTarget})
- list(APPEND _targetsDefined ${_expectedTarget})
- endif()
- endforeach()
- if("${_targetsDefined}" STREQUAL "${_expectedTargets}")
- set(CMAKE_IMPORT_FILE_VERSION)
- cmake_policy(POP)
- return()
- endif()
- if(NOT "${_targetsDefined}" STREQUAL "")
- message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_targetsDefined}\nTargets not yet defined: ${_targetsNotDefined}\n")
- endif()
- unset(_targetsDefined)
- unset(_targetsNotDefined)
- unset(_expectedTargets)
- # Create imported target mkclass
- add_executable(mkclass IMPORTED)
- # Create imported target mkembedconfig
- add_executable(mkembedconfig IMPORTED)
- # Create imported target mkunity
- add_executable(mkunity IMPORTED)
- # Import target "mkclass" for configuration "Release"
- set_property(TARGET mkclass APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
- set_target_properties(mkclass PROPERTIES
- IMPORTED_LOCATION_RELEASE "/tmp/icinga2/icinga2-2.3.4/build/Bin/Release/mkclass"
- )
- # Import target "mkembedconfig" for configuration "Release"
- set_property(TARGET mkembedconfig APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
- set_target_properties(mkembedconfig PROPERTIES
- IMPORTED_LOCATION_RELEASE "/tmp/icinga2/icinga2-2.3.4/build/Bin/Release/mkembedconfig"
- )
- # Import target "mkunity" for configuration "Release"
- set_property(TARGET mkunity APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
- set_target_properties(mkunity PROPERTIES
- IMPORTED_LOCATION_RELEASE "/tmp/icinga2/icinga2-2.3.4/build/Bin/Release/mkunity"
- )
- # This file does not depend on other imported targets which have
- # been exported from the same project but in a separate export set.
- # Commands beyond this point should not need to know the version.
- set(CMAKE_IMPORT_FILE_VERSION)
- cmake_policy(POP)
- ----------------------------------------------------------------------------
- Error message:
- make[5]: *** No rule to make target 'lib/base/mkunity', needed by 'lib/base/base_unity.cpp'. Stop.
Advertisement
Add Comment
Please, Sign In to add comment