Guest User

Untitled

a guest
Jun 5th, 2015
410
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CMake 5.62 KB | None | 0 0
  1. tools/mkunity/CMakeLists.txt:
  2. # Icinga 2
  3. # Copyright (C) 2012-2015 Icinga Development Team (http://www.icinga.org)
  4. #
  5. # This program is free software; you can redistribute it and/or
  6. # modify it under the terms of the GNU General Public License
  7. # as published by the Free Software Foundation; either version 2
  8. # of the License, or (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program; if not, write to the Free Software Foundation
  17. # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
  18.  
  19. define_property(
  20.   SOURCE
  21.   PROPERTY EXCLUDE_UNITY_BUILD
  22.   BRIEF_DOCS "Whether to exclude the source file from unity builds"
  23.   FULL_DOCS "Specified whether a source file should be excluded from unity builds and should be built separately"
  24. )
  25.  
  26. if(ICINGA2_UNITY_BUILD)
  27.   if(CMAKE_CROSSCOMPILING)
  28.     set(IMPORT_EXECUTABLES "IMPORTFILE-NOTFOUND" CACHE FILEPATH "Point it to the export file from a native build")
  29.     include(${IMPORT_EXECUTABLES})
  30.   endif(CMAKE_CROSSCOMPILING)
  31.  
  32.   if(NOT CMAKE_CROSSCOMPILING)
  33.     add_executable(mkunity mkunity.c)
  34.     set_target_properties (
  35.       mkunity PROPERTIES
  36.       FOLDER Bin
  37.     )
  38.     export(TARGETS mkunity APPEND FILE ${CMAKE_BINARY_DIR}/ImportExecutables.cmake )
  39.   endif(NOT CMAKE_CROSSCOMPILING)
  40.  
  41.     function(MKUNITY_TARGET Prefix UnityInputRef)
  42.         set(UnityInput ${${UnityInputRef}})
  43.         set(UnityOutput ${CMAKE_CURRENT_BINARY_DIR}/${Prefix}_unity.cpp)
  44.         set(RealSources "")
  45.         set(UnitySources "")
  46.         foreach(UnitySource ${UnityInput})
  47.             get_property(SourceExcluded SOURCE ${UnitySource} PROPERTY EXCLUDE_UNITY_BUILD)
  48.             if(SourceExcluded MATCHES TRUE OR NOT ${UnitySource} MATCHES "\\.(cpp|cxx|cc)\$")
  49.                 list(APPEND RealSources ${UnitySource})
  50.             else()
  51.                 list(APPEND UnitySources ${UnitySource})
  52.             endif()
  53.         endforeach()
  54.         add_custom_command(
  55.             OUTPUT ${UnityOutput}
  56.             COMMAND mkunity
  57.             ARGS ${Prefix} ${UnitySources} > ${UnityOutput}.tmp
  58.             COMMAND ${CMAKE_COMMAND}
  59.             ARGS -E copy ${UnityOutput}.tmp ${UnityOutput}
  60.             WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
  61.             DEPENDS mkunity ${UnityInput}
  62.         )
  63.         list(APPEND RealSources ${UnityOutput})
  64.         set(${UnityInputRef} ${RealSources} PARENT_SCOPE)
  65.     endfunction()
  66. endif()
  67.  
  68.  
  69. --------------------------------------------------------------------------------------
  70. ImportExecutables.txt
  71. # Generated by CMake 3.0.2
  72.  
  73. if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.5)
  74.    message(FATAL_ERROR "CMake >= 2.6.0 required")
  75. endif()
  76. cmake_policy(PUSH)
  77. cmake_policy(VERSION 2.6)
  78. #----------------------------------------------------------------
  79. # Generated CMake target import file.
  80. #----------------------------------------------------------------
  81.  
  82. # Commands may need to know the format version.
  83. set(CMAKE_IMPORT_FILE_VERSION 1)
  84.  
  85. # Protect against multiple inclusion, which would fail when already imported targets are added once more.
  86. set(_targetsDefined)
  87. set(_targetsNotDefined)
  88. set(_expectedTargets)
  89. foreach(_expectedTarget mkclass mkembedconfig mkunity)
  90.   list(APPEND _expectedTargets ${_expectedTarget})
  91.   if(NOT TARGET ${_expectedTarget})
  92.     list(APPEND _targetsNotDefined ${_expectedTarget})
  93.   endif()
  94.   if(TARGET ${_expectedTarget})
  95.     list(APPEND _targetsDefined ${_expectedTarget})
  96.   endif()
  97. endforeach()
  98. if("${_targetsDefined}" STREQUAL "${_expectedTargets}")
  99.   set(CMAKE_IMPORT_FILE_VERSION)
  100.   cmake_policy(POP)
  101.   return()
  102. endif()
  103. if(NOT "${_targetsDefined}" STREQUAL "")
  104.   message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_targetsDefined}\nTargets not yet defined: ${_targetsNotDefined}\n")
  105. endif()
  106. unset(_targetsDefined)
  107. unset(_targetsNotDefined)
  108. unset(_expectedTargets)
  109.  
  110.  
  111. # Create imported target mkclass
  112. add_executable(mkclass IMPORTED)
  113.  
  114. # Create imported target mkembedconfig
  115. add_executable(mkembedconfig IMPORTED)
  116.  
  117. # Create imported target mkunity
  118. add_executable(mkunity IMPORTED)
  119.  
  120. # Import target "mkclass" for configuration "Release"
  121. set_property(TARGET mkclass APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
  122. set_target_properties(mkclass PROPERTIES
  123.   IMPORTED_LOCATION_RELEASE "/tmp/icinga2/icinga2-2.3.4/build/Bin/Release/mkclass"
  124.   )
  125.  
  126. # Import target "mkembedconfig" for configuration "Release"
  127. set_property(TARGET mkembedconfig APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
  128. set_target_properties(mkembedconfig PROPERTIES
  129.   IMPORTED_LOCATION_RELEASE "/tmp/icinga2/icinga2-2.3.4/build/Bin/Release/mkembedconfig"
  130.   )
  131.  
  132. # Import target "mkunity" for configuration "Release"
  133. set_property(TARGET mkunity APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
  134. set_target_properties(mkunity PROPERTIES
  135.   IMPORTED_LOCATION_RELEASE "/tmp/icinga2/icinga2-2.3.4/build/Bin/Release/mkunity"
  136.   )
  137.  
  138. # This file does not depend on other imported targets which have
  139. # been exported from the same project but in a separate export set.
  140.  
  141. # Commands beyond this point should not need to know the version.
  142. set(CMAKE_IMPORT_FILE_VERSION)
  143. cmake_policy(POP)
  144.  
  145. ----------------------------------------------------------------------------
  146. Error message:
  147. 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