diff options
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/BundleUtilities/CMakeLists.txt | 49 | ||||
-rw-r--r-- | Tests/BundleUtilities/testbundleutils3.cpp | 33 | ||||
-rw-r--r-- | Tests/CMakeCommands/target_link_libraries/depC.cpp | 2 | ||||
-rw-r--r-- | Tests/CMakeOnly/AllFindModules/CMakeLists.txt | 39 | ||||
-rw-r--r-- | Tests/CMakeOnly/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/LoadCommand/CMakeCommands/CMakeLists.txt | 3 | ||||
-rw-r--r-- | Tests/LoadCommand/CMakeLists.txt | 6 | ||||
-rw-r--r-- | Tests/LoadCommand/LoadedCommand.h.in | 6 | ||||
-rw-r--r-- | Tests/Module/GenerateExportHeader/nodeprecated/src/main.cpp | 2 | ||||
-rw-r--r-- | Tests/Module/GenerateExportHeader/override_symbol/main.cpp | 2 | ||||
-rw-r--r-- | Tests/Module/GenerateExportHeader/override_symbol/someclass.cpp | 2 | ||||
-rw-r--r-- | Tests/Module/GenerateExportHeader/prefix/main.cpp | 2 | ||||
-rw-r--r-- | Tests/Module/GenerateExportHeader/prefix/useprefixclass.cpp | 2 |
13 files changed, 129 insertions, 21 deletions
diff --git a/Tests/BundleUtilities/CMakeLists.txt b/Tests/BundleUtilities/CMakeLists.txt index 6209c8f..8f24afe 100644 --- a/Tests/BundleUtilities/CMakeLists.txt +++ b/Tests/BundleUtilities/CMakeLists.txt @@ -82,3 +82,52 @@ add_custom_target(testbundleutils2_test ALL DEPENDS testbundleutils1 module2 ) add_dependencies(testbundleutils2_test testbundleutils2) + + +if(APPLE AND NOT CMAKE_SYSTEM_VERSION VERSION_LESS 9.0) +###### Test a Bundle application using dependencies +###### and @rpaths on Mac OS X 10.5 or greater + + # a shared library + add_library(shared-3 SHARED shared.cpp shared.h) + + # another shared library + add_library(shared2-3 SHARED shared2.cpp shared2.h) + + # a framework library + add_library(framework-3 SHARED framework.cpp framework.h) + set_target_properties(framework-3 PROPERTIES FRAMEWORK 1) + + # build dependencies with @rpath install name + set_target_properties(shared-3 shared2-3 framework-3 PROPERTIES + INSTALL_NAME_DIR "@rpath" + BUILD_WITH_INSTALL_RPATH 1) + + # a loadable module (depends on shared2) + # testbundleutils1 will load this at runtime + add_library(module3 MODULE module.cpp module.h) + set_target_properties(module3 PROPERTIES PREFIX "" LINK_FLAGS "-Wl,-rpath,@loader_path/") + get_target_property(module_loc module3 LOCATION) + target_link_libraries(module3 shared2-3) + + # a non-bundle application + add_executable(testbundleutils3 testbundleutils3.cpp) + target_link_libraries(testbundleutils3 shared-3 framework-3 ${CMAKE_DL_LIBS}) + get_target_property(loc testbundleutils3 LOCATION) + + set_target_properties(testbundleutils3 module3 PROPERTIES + LINK_FLAGS "-Wl,-rpath,@loader_path/") + + # add custom target to install and test the app + add_custom_target(testbundleutils3_test ALL + COMMAND ${CMAKE_COMMAND} + "-DINPUT=${loc}" + "-DMODULE=${module_loc}" + "-DINPUTDIR=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}" + "-DOUTPUTDIR=${CMAKE_CURRENT_BINARY_DIR}/testdir3" + -P "${CMAKE_CURRENT_SOURCE_DIR}/bundleutils.cmake" + DEPENDS testbundleutils3 module3 + ) + + add_dependencies(testbundleutils3_test testbundleutils3) +endif() diff --git a/Tests/BundleUtilities/testbundleutils3.cpp b/Tests/BundleUtilities/testbundleutils3.cpp new file mode 100644 index 0000000..9df13e9 --- /dev/null +++ b/Tests/BundleUtilities/testbundleutils3.cpp @@ -0,0 +1,33 @@ + +#include "framework.h" +#include "shared.h" +#include "stdio.h" + +#if defined(WIN32) +#include <windows.h> +#else +#include "dlfcn.h" +#endif + +int main(int, char**) +{ + framework(); + shared(); + +#if defined(WIN32) + HANDLE lib = LoadLibraryA("module3.dll"); + if(!lib) + { + printf("Failed to open module3\n"); + } +#else + void* lib = dlopen("module3.so", RTLD_LAZY); + if(!lib) + { + printf("Failed to open module3\n%s\n", dlerror()); + } +#endif + + + return lib == 0 ? 1 : 0; +} diff --git a/Tests/CMakeCommands/target_link_libraries/depC.cpp b/Tests/CMakeCommands/target_link_libraries/depC.cpp index 93410a8..60bed59 100644 --- a/Tests/CMakeCommands/target_link_libraries/depC.cpp +++ b/Tests/CMakeCommands/target_link_libraries/depC.cpp @@ -10,4 +10,4 @@ DepA DepC::getA() { DepA a; return a; -}
\ No newline at end of file +} diff --git a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt new file mode 100644 index 0000000..8a38f06 --- /dev/null +++ b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt @@ -0,0 +1,39 @@ +cmake_minimum_required (VERSION 2.8) +project(AllFindModules) + +if (POLICY CMP0017) + cmake_policy(SET CMP0017 NEW) +endif () + +# Avoid ctest truncation of output +message(STATUS "CTEST_FULL_OUTPUT") + +file(GLOB FIND_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../Modules/Find*.cmake" ) + +macro(do_find MODULE_NAME) + message(STATUS " Checking Find${MODULE_NAME}") + find_package(${MODULE_NAME}) +endmacro(do_find) + +foreach(FIND_MODULE ${FIND_MODULES}) + string(REGEX REPLACE ".*/Find(.*)\\.cmake$" "\\1" MODULE_NAME "${FIND_MODULE}") + + # It is only possible to use either Qt3 or Qt4 in one project. + # Since FindQt will complain if both are found we explicitely + # filter out this and FindQt3. FindKDE3 also depends on Qt3 and + # is therefore also blocked + + if (NOT MODULE_NAME STREQUAL "Qt" AND + NOT MODULE_NAME STREQUAL "Qt3" AND + NOT MODULE_NAME STREQUAL "KDE3") + do_find(${MODULE_NAME}) + endif () + +endforeach(FIND_MODULE) + +# Qt4 is not present, so we can check Qt3 +if(NOT QT4_FOUND) + foreach(FIND_MODULE "Qt3" "Qt" "KDE3") + do_find(${FIND_MODULE}) + endforeach(FIND_MODULE) +endif(NOT QT4_FOUND) diff --git a/Tests/CMakeOnly/CMakeLists.txt b/Tests/CMakeOnly/CMakeLists.txt index f6aa9b5..20e6a3a 100644 --- a/Tests/CMakeOnly/CMakeLists.txt +++ b/Tests/CMakeOnly/CMakeLists.txt @@ -14,3 +14,5 @@ set_property(TEST CMakeOnly.LinkInterfaceLoop PROPERTY TIMEOUT 90) add_CMakeOnly_test(CheckSymbolExists) add_CMakeOnly_test(CheckCXXSymbolExists) + +add_CMakeOnly_test(AllFindModules) diff --git a/Tests/LoadCommand/CMakeCommands/CMakeLists.txt b/Tests/LoadCommand/CMakeCommands/CMakeLists.txt index 953d05c..5cdbc59b 100644 --- a/Tests/LoadCommand/CMakeCommands/CMakeLists.txt +++ b/Tests/LoadCommand/CMakeCommands/CMakeLists.txt @@ -5,9 +5,6 @@ IF (MUDSLIDE_TYPE MATCHES MUCHO) ADD_DEFINITIONS(-DMUCHO_MUDSLIDE) ENDIF (MUDSLIDE_TYPE MATCHES MUCHO) -IF(WATCOM) - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") -ENDIF(WATCOM) INCLUDE_DIRECTORIES(${CMAKE_ROOT}/include ${CMAKE_ROOT}/Source) ADD_LIBRARY(cmCMAKE_TEST_COMMAND MODULE cmTestCommand.c) diff --git a/Tests/LoadCommand/CMakeLists.txt b/Tests/LoadCommand/CMakeLists.txt index e99105a..846cbb0 100644 --- a/Tests/LoadCommand/CMakeLists.txt +++ b/Tests/LoadCommand/CMakeLists.txt @@ -12,12 +12,6 @@ INCLUDE (CheckFunctionExists) CHECK_FUNCTION_EXISTS(printf HAVE_PRINTF) CHECK_FUNCTION_EXISTS(vsblabla HAVE_VSBLABLA) -INCLUDE (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake) -CHECK_INCLUDE_FILE("sys/prctl.h" HAVE_SYS_PRCTL_H) - -INCLUDE (${CMAKE_ROOT}/Modules/CheckLibraryExists.cmake) -CHECK_LIBRARY_EXISTS(m ceil "" HAVE_LIBM) - CONFIGURE_FILE(${LoadCommand_SOURCE_DIR}/LoadedCommand.h.in ${LoadCommand_BINARY_DIR}/LoadedCommand.h) diff --git a/Tests/LoadCommand/LoadedCommand.h.in b/Tests/LoadCommand/LoadedCommand.h.in index 7a0a15d..7516a66 100644 --- a/Tests/LoadCommand/LoadedCommand.h.in +++ b/Tests/LoadCommand/LoadedCommand.h.in @@ -5,9 +5,3 @@ /* Check for functions */ #cmakedefine HAVE_PRINTF #cmakedefine HAVE_VSBLABLA - -/* Check for headers */ -#cmakedefine HAVE_SYS_PRCTL_H - -/* Check for libraries */ -#cmakedefine HAVE_LIBM diff --git a/Tests/Module/GenerateExportHeader/nodeprecated/src/main.cpp b/Tests/Module/GenerateExportHeader/nodeprecated/src/main.cpp index 445a652..eec46d3 100644 --- a/Tests/Module/GenerateExportHeader/nodeprecated/src/main.cpp +++ b/Tests/Module/GenerateExportHeader/nodeprecated/src/main.cpp @@ -6,4 +6,4 @@ int main(int, char**) SomeClass sc; sc.someMethod(); return 0; -}
\ No newline at end of file +} diff --git a/Tests/Module/GenerateExportHeader/override_symbol/main.cpp b/Tests/Module/GenerateExportHeader/override_symbol/main.cpp index 445a652..eec46d3 100644 --- a/Tests/Module/GenerateExportHeader/override_symbol/main.cpp +++ b/Tests/Module/GenerateExportHeader/override_symbol/main.cpp @@ -6,4 +6,4 @@ int main(int, char**) SomeClass sc; sc.someMethod(); return 0; -}
\ No newline at end of file +} diff --git a/Tests/Module/GenerateExportHeader/override_symbol/someclass.cpp b/Tests/Module/GenerateExportHeader/override_symbol/someclass.cpp index 7326b78..427ec29 100644 --- a/Tests/Module/GenerateExportHeader/override_symbol/someclass.cpp +++ b/Tests/Module/GenerateExportHeader/override_symbol/someclass.cpp @@ -4,4 +4,4 @@ void SomeClass::someMethod() const { -}
\ No newline at end of file +} diff --git a/Tests/Module/GenerateExportHeader/prefix/main.cpp b/Tests/Module/GenerateExportHeader/prefix/main.cpp index d04ae3c..507f6fd 100644 --- a/Tests/Module/GenerateExportHeader/prefix/main.cpp +++ b/Tests/Module/GenerateExportHeader/prefix/main.cpp @@ -5,4 +5,4 @@ int main(int argc, char **argv) { UsePrefixClass upc; return upc.someMethod(); -}
\ No newline at end of file +} diff --git a/Tests/Module/GenerateExportHeader/prefix/useprefixclass.cpp b/Tests/Module/GenerateExportHeader/prefix/useprefixclass.cpp index 8337ab8..1fd2cb2 100644 --- a/Tests/Module/GenerateExportHeader/prefix/useprefixclass.cpp +++ b/Tests/Module/GenerateExportHeader/prefix/useprefixclass.cpp @@ -4,4 +4,4 @@ int UsePrefixClass::someMethod() const { return 0; -}
\ No newline at end of file +} |