Debian Codegraph @

cmake/FindQtScriptQtBindings.cmake

raw
1 ## Ian Monroe <[email protected]> Copyright 2009
2 # released under public domain or:
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
7 #
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # Lesser General Public License for more details.
12 #
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16 #
17
18 include(CheckCXXSourceRuns)
19
20 if(NOT WIN32)
21 file( READ "${CMAKE_SOURCE_DIR}/cmake/bindingstest/QtScriptBindingsTest.cpp" source )
22 message(STATUS "Checking if the QtScript Qt Bindings are installed.")
23
24
25 set(CMAKE_REQUIRED_DEFINTIONS ${QT_DEFINITIONS})
26 set(CMAKE_REQUIRED_INCLUDES ${QT_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR} ${QT_QTSCRIPT_INCLUDE_DIR})
27 set(CMAKE_REQUIRED_LIBRARIES ${QT_LIBRARY} ${QT_QTSCRIPT_LIBRARY} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY})
28 message( STATUS "includes ${CMAKE_REQUIRED_INCLUDES} libraries ${CMAKE_REQUIRED_LIBRARIES}" )
29 CHECK_CXX_SOURCE_RUNS( "${source}" BINDINGS_RUN_RESULT)
30
31 if(BINDINGS_RUN_RESULT EQUAL 1)
32 message( STATUS "QtBindings found")
33 set(QTSCRIPTQTBINDINGS_FOUND TRUE)
34 else(BINDINGS_RUN_RESULT EQUAL 1)
35 message( STATUS "QtBindings not found. Some functions provided by the script will not be available without QtBindings.")
36 set(QTSCRIPTQTBINDINGS_FOUND FALSE)
37 endif(BINDINGS_RUN_RESULT EQUAL 1)
38
39 set(CMAKE_REQUIRED_DEFINTIONS "" )
40 set(CMAKE_REQUIRED_INCLUDES "")
41 set(CMAKE_REQUIRED_LIBRARIES "")
42 else(NOT WIN32)
43 set(QTSCRIPTQTBINDINGS_FOUND TRUE)
44 endif(NOT WIN32)