1 # - Try to find automoc4
2 # Once done this will define
4 # AUTOMOC4_FOUND - automoc4 has been found
5 # AUTOMOC4_EXECUTABLE - the automoc4 tool
6 # AUTOMOC4_VERSION - the full version of automoc4
7 # AUTOMOC4_VERSION_MAJOR, AUTOMOC4_VERSION_MINOR, AUTOMOC4_VERSION_PATCH - AUTOMOC4_VERSION
8 # broken into its components
10 # It also adds the following macros
11 # AUTOMOC4(<target> <SRCS_VAR>)
12 # Use this to run automoc4 on all files contained in the list <SRCS_VAR>.
14 # AUTOMOC4_MOC_HEADERS(<target> header1.h header2.h ...)
15 # Use this to add more header files to be processed with automoc4.
17 # AUTOMOC4_ADD_EXECUTABLE(<target_NAME> src1 src2 ...)
18 # This macro does the same as ADD_EXECUTABLE, but additionally
19 # adds automoc4 handling for all source files.
21 # AUTOMOC4_ADD_LIBRARY(<target_NAME> src1 src2 ...)
22 # This macro does the same as ADD_LIBRARY, but additionally
23 # adds automoc4 handling for all source files.
25 # Internal helper macro, may change or be removed anytime:
26 # _ADD_AUTOMOC4_TARGET(<target_NAME> <SRCS_VAR>)
28 # Since version 0.9.88:
29 # The following two macros are only to be used for KDE4 projects
30 # and do something which makes sure automoc4 works for KDE. Don't
31 # use them anywhere else.
32 # _AUTOMOC4_KDE4_PRE_TARGET_HANDLING(<target_NAME> <SRCS_VAR>)
33 # _AUTOMOC4_KDE4_POST_TARGET_HANDLING(<target_NAME>)
36 # Copyright (c) 2008-2009, Alexander Neundorf, <neundorf@kde.org>
38 # Redistribution and use is allowed according to the terms of the BSD license.
39 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
42 # check if we are inside KDESupport and automoc is enabled
43 if("${KDESupport_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
44 # when building this project as part of kdesupport
45 set(AUTOMOC4_CONFIG_FILE "${KDESupport_SOURCE_DIR}/automoc/Automoc4Config.cmake")
46 else("${KDESupport_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
47 # when building this project outside kdesupport
49 # CMAKE_[SYSTEM_]PREFIX_PATH exists starting with cmake 2.6.0
50 file(TO_CMAKE_PATH "$ENV{CMAKE_PREFIX_PATH}" _env_CMAKE_PREFIX_PATH)
51 file(TO_CMAKE_PATH "$ENV{CMAKE_LIBRARY_PATH}" _env_CMAKE_LIBRARY_PATH)
53 find_file(AUTOMOC4_CONFIG_FILE NAMES Automoc4Config.cmake
54 PATH_SUFFIXES automoc4 lib/automoc4 lib64/automoc4
55 PATHS ${_env_CMAKE_PREFIX_PATH} ${CMAKE_PREFIX_PATH} ${CMAKE_SYSTEM_PREFIX_PATH}
56 ${_env_CMAKE_LIBRARY_PATH} ${CMAKE_LIBRARY_PATH} ${CMAKE_SYSTEM_LIBRARY_PATH}
57 ${CMAKE_INSTALL_PREFIX}
59 endif("${KDESupport_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
62 if(AUTOMOC4_CONFIG_FILE)
63 include(${AUTOMOC4_CONFIG_FILE})
64 set(AUTOMOC4_FOUND TRUE)
65 else(AUTOMOC4_CONFIG_FILE)
66 set(AUTOMOC4_FOUND FALSE)
67 endif(AUTOMOC4_CONFIG_FILE)
70 if (NOT Automoc4_FIND_QUIETLY)
71 message(STATUS "Found Automoc4: ${AUTOMOC4_EXECUTABLE}")
72 endif (NOT Automoc4_FIND_QUIETLY)
74 if (Automoc4_FIND_REQUIRED)
75 message(FATAL_ERROR "Did not find automoc4 (part of kdesupport).")
76 else (Automoc4_FIND_REQUIRED)
77 if (NOT Automoc4_FIND_QUIETLY)
78 message(STATUS "Did not find automoc4 (part of kdesupport).")
79 endif (NOT Automoc4_FIND_QUIETLY)
80 endif (Automoc4_FIND_REQUIRED)
81 endif (AUTOMOC4_FOUND)