From fb0d05a8363b1f37c24f995b9565cb90c8625256 Mon Sep 17 00:00:00 2001 From: Alexander Neundorf Date: Sat, 4 Feb 2006 12:15:29 +0000 Subject: -renamed optional_find_package() to macro_optional_find_package(), to make it clear it is a macro and not a builtin command -kjsembed compiles -CheckCXXSourceCompiles now support multiple include paths -compile fix in kjsembed/value_binding.cpp: prefer the local global.h, otherwise it might end up with the global.h from kio/kio/, depending on the order of include directories -use the new "-o" switch for dcopidl -add a (temporary) workaround for David's uic problem Alex svn path=/trunk/KDE/kdelibs/; revision=505580 The following changes were in SVN, but were removed from git: M pics/CMakeLists.txt --- modules/CheckCXXSourceCompiles.cmake | 53 ++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 modules/CheckCXXSourceCompiles.cmake (limited to 'modules/CheckCXXSourceCompiles.cmake') diff --git a/modules/CheckCXXSourceCompiles.cmake b/modules/CheckCXXSourceCompiles.cmake new file mode 100644 index 00000000..dc696d1f --- /dev/null +++ b/modules/CheckCXXSourceCompiles.cmake @@ -0,0 +1,53 @@ +# - Check if the source code provided in the SOURCE argument compiles. +# CHECK_CXX_SOURCE_COMPILES(SOURCE VAR) +# - macro which checks if the source code compiles\ +# SOURCE - source code to try to compile +# VAR - variable to store size if the type exists. +# Checks the following optional VARIABLES (not arguments) +# CMAKE_REQUIRED_LIBRARIES - Link to extra libraries +# CMAKE_REQUIRED_FLAGS - Extra flags to C compiler +# CMAKE_REQUIRED_INCLUDES - Extra include directories +# + +MACRO(CHECK_CXX_SOURCE_COMPILES SOURCE VAR) + IF("${VAR}" MATCHES "^${VAR}$") + SET(MACRO_CHECK_FUNCTION_DEFINITIONS + "-D${VAR} ${CMAKE_REQUIRED_FLAGS}") + IF(CMAKE_REQUIRED_LIBRARIES) + SET(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES + "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") + ENDIF(CMAKE_REQUIRED_LIBRARIES) + IF(CMAKE_REQUIRED_INCLUDES) + SET(CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES + "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}") + STRING(REGEX REPLACE ";" "\\\\;" CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES "${CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES}") + ENDIF(CMAKE_REQUIRED_INCLUDES) + FILE(WRITE "${CMAKE_BINARY_DIR}/CMakeFiles/CMakeTmp/src.cxx" + "${SOURCE}") + + MESSAGE(STATUS "Performing Test ${VAR}") + TRY_COMPILE(${VAR} + ${CMAKE_BINARY_DIR} + ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeTmp/src.cxx + CMAKE_FLAGS + "${CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES}" + "${CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES}" + OUTPUT_VARIABLE OUTPUT) + IF(${VAR}) + SET(${VAR} 1 CACHE INTERNAL "Test ${FUNCTION}") + MESSAGE(STATUS "Performing Test ${VAR} - Success") + WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeFiles/CMakeOutput.log + "Performing C++ SOURCE FILE Test ${VAR} succeded with the following output:\n" + "${OUTPUT}\n" + "Source file was:\n${SOURCE}\n" APPEND) + ELSE(${VAR}) + MESSAGE(STATUS "Performing Test ${VAR} - Failed") + SET(${VAR} "" CACHE INTERNAL "Test ${FUNCTION}") + WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log + "Performing C++ SOURCE FILE Test ${VAR} failed with the following output:\n" + "${OUTPUT}\n" + "Source file was:\n${SOURCE}\n" APPEND) + ENDIF(${VAR}) + ENDIF("${VAR}" MATCHES "^${VAR}$") +ENDMACRO(CHECK_CXX_SOURCE_COMPILES) + -- cgit v1.2.1