]> git.mxchange.org Git - simgear.git/blob - CMakeModules/GetForceIncludeDefinitions.cmake
Missing return statement
[simgear.git] / CMakeModules / GetForceIncludeDefinitions.cmake
1 # - Get the platform-appropriate flags to add to force inclusion of a file
2 #
3 # The most common use of this is to use a generated config.h-type file
4 # placed out of the source tree in all files.
5 #
6 #  get_force_include_definitions(var forcedincludefiles...) -
7 #   where var is the name of  your desired output variable, and everything
8 #   else is a source file to forcibly include.
9 #   a list item to be filtered.
10 #
11 # Original Author:
12 # 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
13 # http://academic.cleardefinition.com
14 # Iowa State University HCI Graduate Program/VRAC
15 #
16 # Copyright Iowa State University 2009-2010.
17 # Distributed under the Boost Software License, Version 1.0.
18 # (See accompanying file LICENSE_1_0.txt or copy at
19 # http://www.boost.org/LICENSE_1_0.txt)
20
21 if(__get_force_include_definitions)
22         return()
23 endif()
24 set(__get_force_include_definitions YES)
25
26 function(get_force_include_definitions var)
27         set(_flagprefix)
28         if(CMAKE_COMPILER_IS_GNUCXX)
29                 set(_flag "-include")
30         elseif(MSVC)
31                 set(_flag "/FI")
32         else()
33                 message(SEND_ERROR "You don't seem to be using MSVC or GCC, but")
34                 message(SEND_ERROR "the project called get_force_include_definitions.")
35                 message(SEND_ERROR "Contact this project with the name of your")
36                 message(FATAL_ERROR "compiler and preferably the flag to force includes")
37         endif()
38
39         set(_out)
40         foreach(_item ${ARGN})
41                 list(APPEND _out "${_flag} \"${_item}\"")
42         endforeach()
43         set(${var} "${_out}" PARENT_SCOPE)
44 endfunction()