diff options
Diffstat (limited to 'Tests')
30 files changed, 325 insertions, 129 deletions
diff --git a/Tests/Assembler/CMakeLists.txt b/Tests/Assembler/CMakeLists.txt index 5f71036..94a6325 100644 --- a/Tests/Assembler/CMakeLists.txt +++ b/Tests/Assembler/CMakeLists.txt @@ -7,8 +7,9 @@ set(SRCS) # (at least) the following toolchains can process assembler files directly # and also generate assembler files from C: -if("${CMAKE_GENERATOR}" MATCHES "Makefile") - if(("${CMAKE_C_COMPILER_ID}" MATCHES "^(GNU|HP|SunPro|XL)$") OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "Intel" AND UNIX)) +if("${CMAKE_GENERATOR}" MATCHES "Makefile|Xcode" AND + NOT CMAKE_OSX_ARCHITECTURES) + if(("${CMAKE_C_COMPILER_ID}" MATCHES "^(GNU|Clang|HP|SunPro|XL)$") OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "Intel" AND UNIX)) set(C_FLAGS "${CMAKE_C_FLAGS}") separate_arguments(C_FLAGS) set(SRCS main.s) diff --git a/Tests/BuildDepends/CMakeLists.txt b/Tests/BuildDepends/CMakeLists.txt index d3b1f3c..2a70b6e 100644 --- a/Tests/BuildDepends/CMakeLists.txt +++ b/Tests/BuildDepends/CMakeLists.txt @@ -93,16 +93,14 @@ if(EXISTS message("found debug") set(bar "${BuildDepends_BINARY_DIR}/Project/Debug/bar${CMAKE_EXECUTABLE_SUFFIX}") -endif(EXISTS - "${BuildDepends_BINARY_DIR}/Project/Debug/bar${CMAKE_EXECUTABLE_SUFFIX}") +endif() set(zot ${BuildDepends_BINARY_DIR}/Project/zot${CMAKE_EXECUTABLE_SUFFIX}) if(EXISTS "${BuildDepends_BINARY_DIR}/Project/Debug/zot${CMAKE_EXECUTABLE_SUFFIX}" ) message("found debug") set(zot "${BuildDepends_BINARY_DIR}/Project/Debug/zot${CMAKE_EXECUTABLE_SUFFIX}") -endif(EXISTS - "${BuildDepends_BINARY_DIR}/Project/Debug/zot${CMAKE_EXECUTABLE_SUFFIX}") +endif() message("Running ${bar} ") execute_process(COMMAND ${bar} OUTPUT_VARIABLE out RESULT_VARIABLE runResult) @@ -178,13 +176,11 @@ endif() if(EXISTS "${BuildDepends_BINARY_DIR}/Project/Debug/bar${CMAKE_EXECUTABLE_SUFFIX}" ) message("found debug") -endif(EXISTS - "${BuildDepends_BINARY_DIR}/Project/Debug/bar${CMAKE_EXECUTABLE_SUFFIX}") +endif() if(EXISTS "${BuildDepends_BINARY_DIR}/Project/Debug/zot${CMAKE_EXECUTABLE_SUFFIX}" ) message("found debug") -endif(EXISTS - "${BuildDepends_BINARY_DIR}/Project/Debug/zot${CMAKE_EXECUTABLE_SUFFIX}") +endif() message("Running ${bar} ") execute_process(COMMAND ${bar} OUTPUT_VARIABLE out RESULT_VARIABLE runResult) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 9512ea6..35a8d41 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -70,11 +70,6 @@ if(BUILD_TESTING) "Should the tests that run a full sub ctest process be run?" OFF) mark_as_advanced(CTEST_TEST_CTEST) - - option(TEST_KDE4_STABLE_BRANCH - "Should the KDE4 stable branch test be run?" - OFF) - mark_as_advanced(TEST_KDE4_STABLE_BRANCH) endif () # Should tests that use CVS be run? @@ -551,6 +546,16 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ FAIL_REGULAR_EXPRESSION "Unexpected: ") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ArgumentExpansion") + add_test(GeneratorExpression ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/GeneratorExpression" + "${CMake_BINARY_DIR}/Tests/GeneratorExpression" + --build-generator ${CMAKE_TEST_GENERATOR} + --build-project GeneratorExpression + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + ) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/GeneratorExpression") + add_test(CustomCommand ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/CustomCommand" @@ -794,9 +799,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ NOT "$ENV{COVFILE}" STREQUAL "" OR CMAKE_RUN_LONG_TESTS) set(CTEST_RUN_CPackTestAllGenerators ${CTEST_TEST_CPACK}) - endif(CMAKE_CXX_FLAGS MATCHES "-ftest-coverage" OR - NOT "$ENV{COVFILE}" STREQUAL "" OR - CMAKE_RUN_LONG_TESTS) + endif() endif() if(CTEST_RUN_CPackTestAllGenerators) @@ -1217,9 +1220,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ "${CMake_BINARY_DIR}/Tests/SubDirSpaces/testfromsubdir.obj" ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SubDirSpaces") - endif (MAKE_IS_GNU OR - "${CMAKE_TEST_MAKEPROGRAM}" MATCHES "nmake|gmake|wmake" OR - "${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio|XCode|Borland") + endif () if (WIN32) add_test(SubDir ${CMAKE_CTEST_COMMAND} @@ -2106,43 +2107,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ endif () endif () - if (CMAKE_RUN_LONG_TESTS AND TEST_KDE4_STABLE_BRANCH) - if(UNIX) - if(NOT QT4_FOUND) - find_package(Qt4) - endif() - - set(TRY_BUILD_KDE4 TRUE) - if(QT4_FOUND) - # check whether it's Qt 4.5 in a cmake 2.4. compatible way: - if(NOT EXISTS "${QT_QTNETWORK_INCLUDE_DIR}/QAbstractNetworkCache") - set(TRY_BUILD_KDE4 FALSE) - endif() - else() - set(TRY_BUILD_KDE4 FALSE) - endif() - - find_package(Perl) - if(NOT PERL_FOUND) - set(TRY_BUILD_KDE4 FALSE) - endif() - - find_package(ZLIB) - if(NOT ZLIB_FOUND) - set(TRY_BUILD_KDE4 FALSE) - endif() - - if(TRY_BUILD_KDE4) - file(MAKE_DIRECTORY ${CMake_BINARY_DIR}/Tests/KDE4StableBranchTest) - set(TEST_KDE4_BASE_DIR ${CMake_BINARY_DIR}/Tests/KDE4StableBranchTest) - configure_file(${CMake_SOURCE_DIR}/Tests/KDE4StableBranchTest/test_kde4.sh.in ${CMake_BINARY_DIR}/Tests/KDE4StableBranchTest/test_kde4.sh @ONLY) - execute_process(COMMAND chmod 755 ${CMake_BINARY_DIR}/Tests/KDE4StableBranchTest/test_kde4.sh ) - add_test(KDE4StableBranchTest ${CMake_BINARY_DIR}/Tests/KDE4StableBranchTest/test_kde4.sh) - endif() - - endif() - endif () - if("${CMAKE_TEST_GENERATOR}" MATCHES Xcode) set(CMAKE_SKIP_BOOTSTRAP_TEST 1) endif() diff --git a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt index fb0bd15..212c758 100644 --- a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt +++ b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt @@ -70,7 +70,7 @@ endmacro() # If any of these modules reported that it was found a version number should have been # reported. -foreach(VTEST ALSA ARMADILLO BZIP2 CUPS CURL EXPAT FREETYPE GETTEXT GIT HSPELL +foreach(VTEST ALSA ARMADILLO BZIP2 CUPS CURL EXPAT FREETYPE GETTEXT GIT HG HSPELL JASPER LIBLZMA LIBXML2 LIBXSLT PERL PKG_CONFIG PostgreSQL TIFF ZLIB) check_version_string(${VTEST} ${VTEST}_VERSION_STRING) endforeach() diff --git a/Tests/CMakeTests/ListTest.cmake.in b/Tests/CMakeTests/ListTest.cmake.in index 07fc7c6..a167503 100644 --- a/Tests/CMakeTests/ListTest.cmake.in +++ b/Tests/CMakeTests/ListTest.cmake.in @@ -86,3 +86,14 @@ TEST("REVERSE result" "ken;brad;bill;andy") set(result bill andy bill brad ken ken ken) list(REMOVE_DUPLICATES result) TEST("REMOVE_DUPLICATES result" "bill;andy;brad;ken") + +# these commands should just do nothing if the list is already empty +set(result "") +list(REMOVE_DUPLICATES result) +TEST("REMOVE_DUPLICATES empty result" "") + +list(REVERSE result) +TEST("REVERSE empty result" "") + +list(SORT result) +TEST("SORT empty result" "") diff --git a/Tests/ExternalProject/CMakeLists.txt b/Tests/ExternalProject/CMakeLists.txt index 7a76261..33ffe2e 100644 --- a/Tests/ExternalProject/CMakeLists.txt +++ b/Tests/ExternalProject/CMakeLists.txt @@ -6,6 +6,7 @@ include(ExternalProject) find_package(CVS) find_package(Subversion) find_package(Git) +find_package(Hg) option(ExternalProjectTest_USE_FOLDERS "Enable folder grouping in IDEs." ON) if(ExternalProjectTest_USE_FOLDERS) @@ -511,6 +512,76 @@ if(do_git_tests) set_property(TARGET ${proj} PROPERTY FOLDER "GIT") endif() +set(do_hg_tests 0) + +if(HG_EXECUTABLE) + set(do_hg_tests 1) +endif() + +if(do_hg_tests) + set(local_hg_repo "../../LocalRepositories/HG") + + # Unzip/untar the hg repository in our source folder so that other + # projects below may use it to test hg args of ExternalProject_Add + # + set(proj SetupLocalHGRepository) + ExternalProject_Add(${proj} + SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/LocalRepositories/HG + URL ${CMAKE_CURRENT_SOURCE_DIR}/hgrepo.tgz + BUILD_COMMAND "" + CONFIGURE_COMMAND "${HG_EXECUTABLE}" --version + INSTALL_COMMAND "" + ) + set_property(TARGET ${proj} + PROPERTY FOLDER "SetupRepos/Local/Deeply/Nested/For/Testing") + + + # hg by commit id: + # + set(proj TutorialStep1-HG-byhash) + ExternalProject_Add(${proj} + HG_REPOSITORY "${local_hg_repo}" + HG_TAG dd2ce38a6b8a + UPDATE_COMMAND "" + CMAKE_GENERATOR "${CMAKE_GENERATOR}" + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> + INSTALL_COMMAND "" + DEPENDS "SetupLocalHGRepository" + ) + set_property(TARGET ${proj} PROPERTY FOLDER "HG") + + # hg by explicit branch/tag name: + # + set(proj TutorialStep1-HG-bytag) + ExternalProject_Add(${proj} + HG_REPOSITORY "${local_hg_repo}" + HG_TAG "default" + UPDATE_COMMAND "" + CMAKE_GENERATOR "${CMAKE_GENERATOR}" + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> + INSTALL_COMMAND "" + DEPENDS "SetupLocalHGRepository" + ) + set_property(TARGET ${proj} PROPERTY FOLDER "HG") + + # Live hg / tip (no HG_TAG): + # + # Mercurial 2.1 does not distinguish an empty pull from a failed pull, + # so do not run the test with that version. + if(NOT "${HG_VERSION_STRING}" STREQUAL "2.1") + set(proj TutorialStep1-HG-tip) + ExternalProject_Add(${proj} + HG_REPOSITORY "${local_hg_repo}" + CMAKE_GENERATOR "${CMAKE_GENERATOR}" + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> + INSTALL_COMMAND "" + DEPENDS "SetupLocalHGRepository" + LOG_UPDATE 1 + ) + set_property(TARGET ${proj} PROPERTY FOLDER "HG") + endif() +endif() + # Test the testable built/installed products: # @@ -581,5 +652,5 @@ endif() message(STATUS "can_build_tutorial_step5='${can_build_tutorial_step5}'") message(STATUS "do_cvs_tests='${do_cvs_tests}'") message(STATUS "do_svn_tests='${do_svn_tests}'") -message(STATUS "do_git_tests='${do_git_tests}'") -message(STATUS "GIT_EXECUTABLE='${GIT_EXECUTABLE}'") +message(STATUS "do_git_tests='${do_git_tests}' GIT_EXECUTABLE='${GIT_EXECUTABLE}'") +message(STATUS "do_hg_tests='${do_hg_tests}' HG_EXECUTABLE='${HG_EXECUTABLE}'") diff --git a/Tests/ExternalProject/hgrepo.tgz b/Tests/ExternalProject/hgrepo.tgz Binary files differnew file mode 100644 index 0000000..0d75ce2 --- /dev/null +++ b/Tests/ExternalProject/hgrepo.tgz diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt new file mode 100644 index 0000000..2b135dc --- /dev/null +++ b/Tests/GeneratorExpression/CMakeLists.txt @@ -0,0 +1,28 @@ +cmake_minimum_required (VERSION 2.8.8) +project(GeneratorExpression NONE) + +add_custom_target(check ALL + COMMAND ${CMAKE_COMMAND} + -Dtest_0=$<0:nothing> + -Dtest_1=$<1:content> + -Dconfig=$<CONFIGURATION> + -Dtest_and_0=$<AND:0> + -Dtest_and_0_0=$<AND:0,0> + -Dtest_and_0_1=$<AND:0,1> + -Dtest_and_1=$<AND:1> + -Dtest_and_1_0=$<AND:1,0> + -Dtest_and_1_1=$<AND:1,1> + -Dtest_config_0=$<CONFIG:$<CONFIGURATION>x> + -Dtest_config_1=$<CONFIG:$<CONFIGURATION>> + -Dtest_not_0=$<NOT:0> + -Dtest_not_1=$<NOT:1> + -Dtest_or_0=$<OR:0> + -Dtest_or_0_0=$<OR:0,0> + -Dtest_or_0_1=$<OR:0,1> + -Dtest_or_1=$<OR:1> + -Dtest_or_1_0=$<OR:1,0> + -Dtest_or_1_1=$<OR:1,1> + -P ${CMAKE_CURRENT_SOURCE_DIR}/check.cmake + COMMAND ${CMAKE_COMMAND} -E echo "check done" + VERBATIM + ) diff --git a/Tests/GeneratorExpression/check.cmake b/Tests/GeneratorExpression/check.cmake new file mode 100644 index 0000000..e243d85 --- /dev/null +++ b/Tests/GeneratorExpression/check.cmake @@ -0,0 +1,25 @@ +macro(check var val) + if(NOT "${${var}}" STREQUAL "${val}") + message(SEND_ERROR "${var} is \"${${var}}\", not \"${val}\"") + endif() +endmacro() + +message(STATUS "config=[${config}]") +check(test_0 "") +check(test_1 "content") +check(test_and_0 "0") +check(test_and_0_0 "0") +check(test_and_0_1 "0") +check(test_and_1 "1") +check(test_and_1_0 "0") +check(test_and_1_1 "1") +check(test_config_0 "0") +check(test_config_1 "1") +check(test_not_0 "1") +check(test_not_1 "0") +check(test_or_0 "0") +check(test_or_0_0 "0") +check(test_or_0_1 "1") +check(test_or_1 "1") +check(test_or_1_0 "1") +check(test_or_1_1 "1") diff --git a/Tests/KDE4StableBranchTest/test_kde4.sh.in b/Tests/KDE4StableBranchTest/test_kde4.sh.in deleted file mode 100755 index bc90b9d..0000000 --- a/Tests/KDE4StableBranchTest/test_kde4.sh.in +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/sh - -# This shell script tests whether cmake is able to build the latest -# stable KDE4 release, or at least some part of it. -# It downloads automoc from KDE svn, builds and installs it, then it -# downloads phonon from KDE svn, builds and installs it, and finally -# it downloads kdelibs (currently from the 4.3 branch), and builds -# a (small) part of it, i.e. libkdecore and one unit test depending on it. -# -# <neundorf AT kde.org> - -CMAKE="@CMAKE_CMAKE_COMMAND@" -BASEDIR="@TEST_KDE4_BASE_DIR@" -INSTALLDIR="$BASEDIR/install" -QMAKE="@QT_QMAKE_EXECUTABLE@" - -cd "$BASEDIR" || exit -1 -echo "Removing old install dir " $INSTALLDIR - -rm -rf install || exit -1 -rm -rf build-automoc || exit -1 -rm -rf build-phonon || exit -1 -rm -rf build-kdelibs || exit -1 - - - -# build and install automoc -cd "$BASEDIR" || exit -1 -svn co svn://anonsvn.kde.org/home/kde/tags/kdesupport-for-4.3/kdesupport/automoc || exit -1 - -mkdir -p build-automoc || exit -1 - -cd build-automoc || exit -1 -"$CMAKE" -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DQT_QMAKE_EXECUTABLE:STRING="$QMAKE" ../automoc || exit -1 -"$CMAKE" --build . || exit -1 -"$CMAKE" -P cmake_install.cmake || exit -1 - -export CMAKE_PREFIX_PATH="$INSTALLDIR:$CMAKE_PREFIX_PATH" - - -# build and install phonon -cd "$BASEDIR" || exit -1 -svn co svn://anonsvn.kde.org/home/kde/tags/kdesupport-for-4.3/kdesupport/phonon || exit -1 - -mkdir -p build-phonon || exit -1 - -cd build-phonon || exit -1 -"$CMAKE" -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DQT_QMAKE_EXECUTABLE:STRING="$QMAKE" -DWITH_GLIB2=FALSE -DWITH_GObject=FALSE -DWITH_GStreamer=FALSE -DWITH_GStreamerPlugins=FALSE -DWITH_OpenGL=FALSE -DWITH_XCB=FALSE -DWITH_Xine=FALSE ../phonon || exit -1 -"$CMAKE" --build . || exit -1 -"$CMAKE" -P cmake_install.cmake || exit -1 - - -# finally build kdelibs/kdecore -cd "$BASEDIR" || exit -1 - -svn co svn://anonsvn.kde.org/home/kde/branches/KDE/4.3/kdelibs/ || exit -1 -mkdir -p build-kdelibs || exit -1 -cd build-kdelibs || exit -1 -# trick cmake into not searching strigi and not searching sharedmimeinfo -"$CMAKE" -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DQT_QMAKE_EXECUTABLE:STRING="$QMAKE" -DSTRIGI_FOUND=TRUE -DSTRIGI_INCLUDE_DIR=/usr/include -DSTRIGI_STREAMANALYZER_LIBRARY=-lc -DSTRIGI_STREAMS_LIBRARY=-lc -DSTRIGI_STRIGIQTDBUSCLIENT_LIBRARY=-lc -DSTRIGI_NEEDS_SIGNED_CHAR=TRUE -DSTRIGI_NEEDS_CHAR=FALSE -DUPDATE_MIME_DATABASE_EXECUTABLE=/bin/sh ../kdelibs || exit -1 -make -C kdecore/tests kurltest || exit -1 - diff --git a/Tests/Module/CheckTypeSize/CMakeLists.txt b/Tests/Module/CheckTypeSize/CMakeLists.txt index 45e9f67..abe617a 100644 --- a/Tests/Module/CheckTypeSize/CMakeLists.txt +++ b/Tests/Module/CheckTypeSize/CMakeLists.txt @@ -12,7 +12,13 @@ check_type_size(__int64 SIZEOF___INT64) check_type_size(size_t SIZEOF_SIZE_T) check_type_size(ssize_t SIZEOF_SSIZE_T) +set(CMAKE_REQUIRED_INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}") +set(CMAKE_EXTRA_INCLUDE_FILES somestruct.h) +check_type_size("((struct somestruct*)0)->someint" SIZEOF_STRUCTMEMBER_INT) +check_type_size("((struct somestruct*)0)->someptr" SIZEOF_STRUCTMEMBER_PTR) +check_type_size("((struct somestruct*)0)->somechar" SIZEOF_STRUCTMEMBER_CHAR) + configure_file(config.h.in config.h) -include_directories(${CheckTypeSize_BINARY_DIR}) +include_directories("${CheckTypeSize_BINARY_DIR}") add_executable(CheckTypeSize CheckTypeSize.c) diff --git a/Tests/Module/CheckTypeSize/CheckTypeSize.c b/Tests/Module/CheckTypeSize/CheckTypeSize.c index 602c834..32e395c 100644 --- a/Tests/Module/CheckTypeSize/CheckTypeSize.c +++ b/Tests/Module/CheckTypeSize/CheckTypeSize.c @@ -1,4 +1,5 @@ #include "config.h" +#include "somestruct.h" #ifdef HAVE_SYS_TYPES_H # include <sys/types.h> @@ -29,6 +30,7 @@ int main() { int result = 0; + struct somestruct x; /* void* */ #if !defined(HAVE_SIZEOF_DATA_PTR) @@ -118,5 +120,41 @@ int main() NODEF(SIZEOF_SSIZE_T); #endif - return result; + /* struct somestruct::someint */ +#if defined(SIZEOF_STRUCTMEMBER_INT) + CHECK(x.someint, SIZEOF_STRUCTMEMBER_INT); + CHECK(x.someint, SIZEOF_INT); +# if !defined(HAVE_SIZEOF_STRUCTMEMBER_INT) + NODEF(HAVE_SIZEOF_STRUCTMEMBER_INT); +# endif +#elif defined(HAVE_SIZEOF_STRUCTMEMBER_INT) + NODEF(SIZEOF_STRUCTMEMBER_INT); +#endif + + /* struct somestruct::someptr */ +#if defined(SIZEOF_STRUCTMEMBER_PTR) + CHECK(x.someptr, SIZEOF_STRUCTMEMBER_PTR); + CHECK(x.someptr, SIZEOF_DATA_PTR); +# if !defined(HAVE_SIZEOF_STRUCTMEMBER_PTR) + NODEF(HAVE_SIZEOF_STRUCTMEMBER_PTR); +# endif +#elif defined(HAVE_SIZEOF_STRUCTMEMBER_PTR) + NODEF(SIZEOF_STRUCTMEMBER_PTR); +#endif + + /* struct somestruct::someint */ +#if defined(SIZEOF_STRUCTMEMBER_CHAR) + CHECK(x.somechar, SIZEOF_STRUCTMEMBER_CHAR); + CHECK(x.somechar, SIZEOF_CHAR); +# if !defined(HAVE_SIZEOF_STRUCTMEMBER_CHAR) + NODEF(HAVE_SIZEOF_STRUCTMEMBER_CHAR); +# endif +#elif defined(HAVE_SIZEOF_STRUCTMEMBER_CHAR) + NODEF(SIZEOF_STRUCTMEMBER_CHAR); +#endif + + /* to avoid possible warnings about unused or write-only variable */ + x.someint = result; + + return x.someint; } diff --git a/Tests/Module/CheckTypeSize/config.h.in b/Tests/Module/CheckTypeSize/config.h.in index b5bfbf6..c601075 100644 --- a/Tests/Module/CheckTypeSize/config.h.in +++ b/Tests/Module/CheckTypeSize/config.h.in @@ -37,3 +37,15 @@ /* ssize_t */ #cmakedefine HAVE_SIZEOF_SSIZE_T @SIZEOF_SSIZE_T_CODE@ + +/* struct somestruct::someint */ +#cmakedefine HAVE_SIZEOF_STRUCTMEMBER_INT +@SIZEOF_STRUCTMEMBER_INT_CODE@ + +/* struct somestruct::someptr */ +#cmakedefine HAVE_SIZEOF_STRUCTMEMBER_PTR +@SIZEOF_STRUCTMEMBER_PTR_CODE@ + +/* struct somestruct::somechar */ +#cmakedefine HAVE_SIZEOF_STRUCTMEMBER_CHAR +@SIZEOF_STRUCTMEMBER_CHAR_CODE@ diff --git a/Tests/Module/CheckTypeSize/somestruct.h b/Tests/Module/CheckTypeSize/somestruct.h new file mode 100644 index 0000000..e08efc4 --- /dev/null +++ b/Tests/Module/CheckTypeSize/somestruct.h @@ -0,0 +1,10 @@ +#ifndef _CMAKE_SOMESTRUCT_H +#define _CMAKE_SOMESTRUCT_H + +struct somestruct { + int someint; + void *someptr; + char somechar; +}; + +#endif diff --git a/Tests/Properties/CMakeLists.txt b/Tests/Properties/CMakeLists.txt index 7bf9c2d..285d596 100644 --- a/Tests/Properties/CMakeLists.txt +++ b/Tests/Properties/CMakeLists.txt @@ -53,15 +53,13 @@ get_property(SOURCERESULT if (RESULT1 AND RESULT2 AND RESULT3 AND GLOBALRESULT AND DIRECTORYRESULT AND SOURCERESULT) add_executable (Properties SubDir/properties3.cxx properties) -else (RESULT1 AND RESULT2 AND RESULT3 AND GLOBALRESULT AND - DIRECTORYRESULT AND SOURCERESULT) +else () message(SEND_ERROR "Error: test results are RESULT1=${RESULT1} RESULT2=${RESULT2} " "RESULT3=${RESULT3} GLOBALRESULT=${GLOBALRESULT} " "DIRECTORYRESULT=${DIRECTORYRESULT} " "SOURCERESULT=${SOURCERESULT}") -endif (RESULT1 AND RESULT2 AND RESULT3 AND GLOBALRESULT AND - DIRECTORYRESULT AND SOURCERESULT) +endif () # test the target property set_property(TARGET Properties PROPERTY TARGETTEST 1) diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index eca96f9..3ea54f1 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -45,6 +45,7 @@ macro(add_RunCMake_test test) ) endmacro() +add_RunCMake_test(GeneratorExpression) add_RunCMake_test(Languages) add_RunCMake_test(ObjectLibrary) diff --git a/Tests/RunCMake/GeneratorExpression/BadAND-result.txt b/Tests/RunCMake/GeneratorExpression/BadAND-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadAND-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/BadAND-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadAND-stderr.txt new file mode 100644 index 0000000..ced21d8 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadAND-stderr.txt @@ -0,0 +1,17 @@ +CMake Error at BadAND.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<AND:> + + AND requires one or more comma-separated '0' or '1' values. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadAND.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<AND:,> + + AND requires one or more comma-separated '0' or '1' values. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/GeneratorExpression/BadAND.cmake b/Tests/RunCMake/GeneratorExpression/BadAND.cmake new file mode 100644 index 0000000..7926540 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadAND.cmake @@ -0,0 +1,4 @@ +add_custom_target(check ALL COMMAND check + $<AND:> + $<AND:,> + VERBATIM) diff --git a/Tests/RunCMake/GeneratorExpression/BadCONFIG-result.txt b/Tests/RunCMake/GeneratorExpression/BadCONFIG-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadCONFIG-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/BadCONFIG-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadCONFIG-stderr.txt new file mode 100644 index 0000000..7c86b25 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadCONFIG-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at BadCONFIG.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<CONFIG:.> + + Expression syntax not recognized. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/GeneratorExpression/BadCONFIG.cmake b/Tests/RunCMake/GeneratorExpression/BadCONFIG.cmake new file mode 100644 index 0000000..0c13f89 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadCONFIG.cmake @@ -0,0 +1,3 @@ +add_custom_target(check ALL COMMAND check + $<CONFIG:.> + VERBATIM) diff --git a/Tests/RunCMake/GeneratorExpression/BadNOT-result.txt b/Tests/RunCMake/GeneratorExpression/BadNOT-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadNOT-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/BadNOT-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadNOT-stderr.txt new file mode 100644 index 0000000..5721f5f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadNOT-stderr.txt @@ -0,0 +1,26 @@ +CMake Error at BadNOT.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<NOT:> + + NOT requires exactly one '0' or '1' value. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadNOT.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<NOT:,> + + NOT requires exactly one '0' or '1' value. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadNOT.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<NOT:0,1> + + NOT requires exactly one '0' or '1' value. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/GeneratorExpression/BadNOT.cmake b/Tests/RunCMake/GeneratorExpression/BadNOT.cmake new file mode 100644 index 0000000..452293b --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadNOT.cmake @@ -0,0 +1,5 @@ +add_custom_target(check ALL COMMAND check + $<NOT:> + $<NOT:,> + $<NOT:0,1> + VERBATIM) diff --git a/Tests/RunCMake/GeneratorExpression/BadOR-result.txt b/Tests/RunCMake/GeneratorExpression/BadOR-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadOR-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/BadOR-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadOR-stderr.txt new file mode 100644 index 0000000..72ef2dd --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadOR-stderr.txt @@ -0,0 +1,17 @@ +CMake Error at BadOR.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<OR:> + + OR requires one or more comma-separated '0' or '1' values. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadOR.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<OR:,> + + OR requires one or more comma-separated '0' or '1' values. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/GeneratorExpression/BadOR.cmake b/Tests/RunCMake/GeneratorExpression/BadOR.cmake new file mode 100644 index 0000000..f16f56a --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadOR.cmake @@ -0,0 +1,4 @@ +add_custom_target(check ALL COMMAND check + $<OR:> + $<OR:,> + VERBATIM) diff --git a/Tests/RunCMake/GeneratorExpression/CMakeLists.txt b/Tests/RunCMake/GeneratorExpression/CMakeLists.txt new file mode 100644 index 0000000..e8db6b0 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake new file mode 100644 index 0000000..ed18f25 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake @@ -0,0 +1,6 @@ +include(RunCMake) + +run_cmake(BadCONFIG) +run_cmake(BadOR) +run_cmake(BadAND) +run_cmake(BadNOT) |