summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CMakeLists.txt43
-rw-r--r--Tests/CPackComponentsForAll/CMakeLists.txt120
-rw-r--r--Tests/CPackComponentsForAll/MyLibCPackConfig.cmake.in7
-rw-r--r--Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake73
-rw-r--r--Tests/CPackComponentsForAll/mylib.cpp7
-rw-r--r--Tests/CPackComponentsForAll/mylib.h1
-rw-r--r--Tests/CPackComponentsForAll/mylibapp.cpp6
-rw-r--r--Tests/Complex/Executable/CMakeLists.txt9
-rw-r--r--Tests/Complex/Executable/complex_nobuild.c1
-rw-r--r--Tests/CustomCommand/CMakeLists.txt13
-rw-r--r--Tests/Jump/Library/Shared/CMakeLists.txt4
-rw-r--r--Tests/PerConfig/CMakeLists.txt34
-rw-r--r--Tests/PerConfig/pcShared.c (renamed from Tests/Testing/pcShared.c)0
-rw-r--r--Tests/PerConfig/pcShared.h (renamed from Tests/Testing/pcShared.h)0
-rw-r--r--Tests/PerConfig/pcStatic.c (renamed from Tests/Testing/pcStatic.c)0
-rw-r--r--Tests/PerConfig/perconfig.c (renamed from Tests/Testing/perconfig.c)0
-rw-r--r--Tests/PerConfig/perconfig.cmake (renamed from Tests/Testing/driver.cmake)2
-rw-r--r--Tests/Testing/CMakeLists.txt34
-rw-r--r--Tests/Testing/Sub/Sub2/CMakeLists.txt12
-rw-r--r--Tests/TestsWorkingDirectory/CMakeLists.txt52
-rw-r--r--Tests/TestsWorkingDirectory/main.c66
-rw-r--r--Tests/TryCompile/CMakeLists.txt6
22 files changed, 455 insertions, 35 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 8f29641..911b247 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -488,6 +488,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
#
set(CTEST_RUN_CPackComponents ${CTEST_TEST_CPACK})
set(CTEST_package_X11_TEST ${CTEST_TEST_CPACK})
+ set(CTEST_RUN_CPackComponentsForAll ${CTEST_TEST_CPACK})
find_program(NSIS_MAKENSIS_EXECUTABLE NAMES makensis
PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS]
@@ -536,6 +537,34 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CPackComponents")
ENDIF(CTEST_RUN_CPackComponents)
+ IF(CTEST_RUN_CPackComponentsForAll)
+ set(CPackComponentsForAll_EXTRA_OPTIONS)
+
+ set(CPackRun_CPackGen "-DCPackGen=ZIP")
+ set(CPackRun_CPackCommand "-DCPackCommand=${CMAKE_CPACK_COMMAND}")
+ set(CPackRun_CPackComponentWay "-DCPackComponentWay=default")
+
+ ADD_TEST(CPackComponentsForAll-ZIP-default ${CMAKE_CTEST_COMMAND}
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/CPackComponentsForAll"
+ "${CMake_BINARY_DIR}/Tests/CPackComponentsForAll/buildZIP-NoComponent"
+ --build-generator ${CMAKE_TEST_GENERATOR}
+ --build-project CPackComponentsForAll
+ --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
+ --build-options
+ -DCPACK_BINARY_ZIP:BOOL=ON
+ ${CPackComponentsForAll_EXTRA_OPTIONS}
+ --graphviz=CPackComponentsForAll.dot
+ --test-command ${CMAKE_CMAKE_COMMAND}
+ "-DCPackComponentsForAll_BINARY_DIR:PATH=${CMake_BINARY_DIR}/Tests/CPackComponentsForAll/buildZIP-NoComponent"
+ "${CPackRun_CPackCommand}"
+ "${CPackRun_CPackGen}"
+ "${CPackRun_CPackComponentWay}"
+ -P "${CMake_SOURCE_DIR}/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake")
+
+ LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CPackComponentsForAll")
+ ENDIF(CTEST_RUN_CPackComponentsForAll)
+
# By default, turn this test off (because it takes a long time...)
#
if(NOT DEFINED CTEST_RUN_CPackTestAllGenerators)
@@ -781,6 +810,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
--test-command ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE}
)
+ SET_TESTS_PROPERTIES(testing PROPERTIES PASS_REGULAR_EXPRESSION "Passed")
LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Testing")
ADD_TEST(wrapping ${CMAKE_CTEST_COMMAND}
@@ -1086,6 +1116,19 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BundleGeneratorTest")
ENDIF(APPLE AND CTEST_TEST_CPACK)
+ ADD_TEST(TestsWorkingDirectory ${CMAKE_CTEST_COMMAND}
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/TestsWorkingDirectory"
+ "${CMake_BINARY_DIR}/Tests/TestsWorkingDirectory"
+ --build-generator ${CMAKE_TEST_GENERATOR}
+ --build-project TestsWorkingDirectoryProj
+ --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
+ --build-exe-dir "${CMake_BINARY_DIR}/Tests/TestsWorkingDirectory"
+ --force-new-ctest-process
+ --test-command ${CMAKE_CTEST_COMMAND} -V
+ )
+ LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/TestsWorkingDirectory")
+
# Make sure CTest can handle a test with no newline in output.
ADD_TEST(CTest.NoNewline
${CMAKE_CMAKE_COMMAND} -E echo_append "This line has no newline!")
diff --git a/Tests/CPackComponentsForAll/CMakeLists.txt b/Tests/CPackComponentsForAll/CMakeLists.txt
new file mode 100644
index 0000000..971b2dc
--- /dev/null
+++ b/Tests/CPackComponentsForAll/CMakeLists.txt
@@ -0,0 +1,120 @@
+# CPack Example: User-selectable Installation Components
+#
+# In this example, we have a simple library (mylib) with an example
+# application (mylibapp). We create a binary installer (a CPack Generator)
+# which supports CPack components.
+#
+# Depending on the CPack generator and on some CPACK_xxx var values
+# the generator may produce a single (NSIS, PackageMaker)
+# or several package files (Archive Generators, RPM, DEB)
+cmake_minimum_required(VERSION 2.8.3.20101130 FATAL_ERROR)
+project(CPackComponentsForAll)
+
+# Create the mylib library
+add_library(mylib mylib.cpp)
+
+# Create the mylibapp application
+add_executable(mylibapp mylibapp.cpp)
+target_link_libraries(mylibapp mylib)
+
+# Duplicate of mylibapp application
+# which won't be put in any component (?mistake?)
+add_executable(mylibapp2 mylibapp.cpp)
+target_link_libraries(mylibapp2 mylib)
+
+# Create installation targets. Note that we put each kind of file
+# into a different component via COMPONENT. These components will
+# be used to create the installation components.
+install(TARGETS mylib
+ ARCHIVE
+ DESTINATION lib
+ COMPONENT libraries)
+install(TARGETS mylibapp
+ RUNTIME
+ DESTINATION bin
+ COMPONENT applications)
+
+# This application does not belong to any component
+# thus (as of cmake 2.8.2) it will be left "uninstalled"
+# by a component-aware installer unless a
+# CPACK_MONOLITHIC_INSTALL=1 is set (at cmake time).
+install(TARGETS mylibapp2
+ RUNTIME
+ DESTINATION bin)
+
+install(FILES mylib.h
+ DESTINATION include
+ COMPONENT headers)
+
+# CPack boilerplate for this project
+set(CPACK_PACKAGE_NAME "MyLib")
+set(CPACK_PACKAGE_CONTACT "None")
+set(CPACK_PACKAGE_VENDOR "CMake.org")
+set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MyLib - CPack Component Installation Example")
+set(CPACK_PACKAGE_VERSION "1.0.2")
+set(CPACK_PACKAGE_VERSION_MAJOR "1")
+set(CPACK_PACKAGE_VERSION_MINOR "0")
+set(CPACK_PACKAGE_VERSION_PATCH "2")
+set(CPACK_PACKAGE_INSTALL_DIRECTORY "CPack Component Example")
+
+# Tell CPack all of the components to install. The "ALL"
+# refers to the fact that this is the set of components that
+# will be included when CPack is instructed to put everything
+# into the binary installer (the default behavior).
+set(CPACK_COMPONENTS_ALL applications libraries headers Unspecified)
+
+# Set the displayed names for each of the components to install.
+# These will be displayed in the list of components inside the installer.
+set(CPACK_COMPONENT_APPLICATIONS_DISPLAY_NAME "MyLib Application")
+set(CPACK_COMPONENT_LIBRARIES_DISPLAY_NAME "Libraries")
+set(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C++ Headers")
+
+# Provide descriptions for each of the components to install.
+# When the user hovers the mouse over the name of a component,
+# the description will be shown in the "Description" box in the
+# installer. If no descriptions are provided, the "Description"
+# box will be removed.
+set(CPACK_COMPONENT_APPLICATIONS_DESCRIPTION
+ "An extremely useful application that makes use of MyLib")
+set(CPACK_COMPONENT_LIBRARIES_DESCRIPTION
+ "Static libraries used to build programs with MyLib")
+set(CPACK_COMPONENT_HEADERS_DESCRIPTION
+ "C/C++ header files for use with MyLib")
+
+# Put the components into two different groups: "Runtime" and "Development"
+set(CPACK_COMPONENT_APPLICATIONS_GROUP "Runtime")
+set(CPACK_COMPONENT_LIBRARIES_GROUP "Development")
+set(CPACK_COMPONENT_HEADERS_GROUP "Development")
+
+# Expand the "Development" group by default, since we have so few components.
+# Also, provide this group with a description.
+set(CPACK_COMPONENT_GROUP_DEVELOPMENT_EXPANDED ON)
+set(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION
+ "All of the tools you'll ever need to develop software")
+
+# It doesn't make sense to install the headers without the libraries
+# (because you could never use the headers!), so make the headers component
+# depend on the libraries component.
+set(CPACK_COMPONENT_HEADERS_DEPENDS libraries)
+
+# Create two installation types with pre-selected components.
+# The "Developer" installation has just the library and headers,
+# while the "Full" installation has everything.
+set(CPACK_ALL_INSTALL_TYPES Full Developer)
+set(CPACK_INSTALL_TYPE_FULL_DISPLAY_NAME "Everything")
+set(CPACK_COMPONENT_LIBRARIES_INSTALL_TYPES Developer Full)
+set(CPACK_COMPONENT_HEADERS_INSTALL_TYPES Developer Full)
+set(CPACK_COMPONENT_APPLICATIONS_INSTALL_TYPES Full)
+
+# We may use the CPack specific config file in order
+# to tailor CPack behavio on a CPack generator specific way
+# (Behavior would be different for RPM or TGZ or DEB ...)
+if (USE_CPACK_PROJECT_CONFIG)
+ # Setup project specific CPack-time CPack Config file.
+ configure_file(${MyLib_SOURCE_DIR}/MyLibCPackConfig.cmake.in
+ ${MyLib_BINARY_DIR}/MyLibCPackConfig.cmake
+ @ONLY)
+ set(CPACK_PROJECT_CONFIG_FILE ${MyLib_BINARY_DIR}/MyLibCPackConfig.cmake)
+endif (USE_CPACK_PROJECT_CONFIG)
+# Include CPack to introduce the appropriate targets
+include(CPack) \ No newline at end of file
diff --git a/Tests/CPackComponentsForAll/MyLibCPackConfig.cmake.in b/Tests/CPackComponentsForAll/MyLibCPackConfig.cmake.in
new file mode 100644
index 0000000..7ffafae
--- /dev/null
+++ b/Tests/CPackComponentsForAll/MyLibCPackConfig.cmake.in
@@ -0,0 +1,7 @@
+if(CPACK_GENERATOR MATCHES "ZIP")
+# set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE 1)
+endif(CPACK_GENERATOR MATCHES "ZIP")
+
+if(CPACK_GENERATOR MATCHES "TGZ")
+ set(CPACK_MONOLITHIC_INSTALL 1)
+endif(CPACK_GENERATOR MATCHES "TGZ")
diff --git a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake
new file mode 100644
index 0000000..11f72ec
--- /dev/null
+++ b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake
@@ -0,0 +1,73 @@
+message(STATUS "=============================================================================")
+message(STATUS "CTEST_FULL_OUTPUT (Avoid ctest truncation of output)")
+message(STATUS "")
+
+if(NOT CPackComponentsForAll_BINARY_DIR)
+ message(FATAL_ERROR "CPackComponentsForAll_BINARY_DIR not set")
+endif(NOT CPackComponentsForAll_BINARY_DIR)
+
+if(NOT CPackGen)
+ message(FATAL_ERROR "CPackGen not set")
+endif(NOT CPackGen)
+get_filename_component(CPACK_LOCATION ${CMAKE_COMMAND} PATH)
+set(CPackCommand "${CPACK_LOCATION}/cpack")
+message("cpack = ${CPackCommand}")
+if(NOT CPackCommand)
+ message(FATAL_ERROR "CPackCommand not set")
+endif(NOT CPackCommand)
+
+if(NOT CPackComponentWay)
+ message(FATAL_ERROR "CPackComponentWay not set")
+endif(NOT CPackComponentWay)
+
+set(expected_file_mask "")
+# The usual default behavior is to expect a single file
+# Then some specific generators (Archive, RPM, ...)
+# May produce several numbers of files depending on
+# CPACK_COMPONENT_xxx values
+set(expected_count 1)
+set(config_type $ENV{CMAKE_CONFIG_TYPE})
+set(config_args )
+if(config_type)
+ set(config_args -C ${config_type})
+endif()
+message(" ${config_args}")
+execute_process(COMMAND ${CPackCommand} -G ${CPackGen} ${config_args}
+ RESULT_VARIABLE CPack_result
+ OUTPUT_VARIABLE CPack_output
+ ERROR_VARIABLE CPack_error
+ WORKING_DIRECTORY ${CPackComponentsForAll_BINARY_DIR})
+
+if (CPack_result)
+ message(FATAL_ERROR "error: CPack execution went wrong!, CPack_output=${CPack_output}, CPack_error=${CPack_error}")
+else (CPack_result)
+ message(STATUS "CPack_output=${CPack_output}")
+endif(CPack_result)
+
+if(CPackGen MATCHES "ZIP")
+ set(expected_file_mask "${CPackComponentsForAll_BINARY_DIR}/MyLib-*.zip")
+ if (${CPackComponentWay} STREQUAL "default")
+ set(expected_count 1)
+ endif(${CPackComponentWay} STREQUAL "default")
+endif(CPackGen MATCHES "ZIP")
+
+# Now verify if the number of expected file is OK
+# - using expected_file_mask and
+# - expected_count
+if(expected_file_mask)
+ file(GLOB expected_file "${expected_file_mask}")
+
+ message(STATUS "expected_count='${expected_count}'")
+ message(STATUS "expected_file='${expected_file}'")
+ message(STATUS "expected_file_mask='${expected_file_mask}'")
+
+ if(NOT expected_file)
+ message(FATAL_ERROR "error: expected_file=${expected_file} does not exist: CPackComponentsForAll test fails. (CPack_output=${CPack_output}, CPack_error=${CPack_error}")
+ endif(NOT expected_file)
+
+ list(LENGTH expected_file actual_count)
+ message(STATUS "actual_count='${actual_count}'")
+ if(NOT actual_count EQUAL expected_count)
+ message(FATAL_ERROR "error: expected_count=${expected_count} does not match actual_count=${actual_count}: CPackComponents test fails. (CPack_output=${CPack_output}, CPack_error=${CPack_error})")
+ endif(NOT actual_count EQUAL expected_count)
+endif(expected_file_mask)
diff --git a/Tests/CPackComponentsForAll/mylib.cpp b/Tests/CPackComponentsForAll/mylib.cpp
new file mode 100644
index 0000000..8ddac19
--- /dev/null
+++ b/Tests/CPackComponentsForAll/mylib.cpp
@@ -0,0 +1,7 @@
+#include "mylib.h"
+#include "stdio.h"
+
+void mylib_function()
+{
+ printf("This is mylib");
+}
diff --git a/Tests/CPackComponentsForAll/mylib.h b/Tests/CPackComponentsForAll/mylib.h
new file mode 100644
index 0000000..5d0a822
--- /dev/null
+++ b/Tests/CPackComponentsForAll/mylib.h
@@ -0,0 +1 @@
+void mylib_function();
diff --git a/Tests/CPackComponentsForAll/mylibapp.cpp b/Tests/CPackComponentsForAll/mylibapp.cpp
new file mode 100644
index 0000000..a438ac7
--- /dev/null
+++ b/Tests/CPackComponentsForAll/mylibapp.cpp
@@ -0,0 +1,6 @@
+#include "mylib.h"
+
+int main()
+{
+ mylib_function();
+}
diff --git a/Tests/Complex/Executable/CMakeLists.txt b/Tests/Complex/Executable/CMakeLists.txt
index 98b29bb..08cc7d4 100644
--- a/Tests/Complex/Executable/CMakeLists.txt
+++ b/Tests/Complex/Executable/CMakeLists.txt
@@ -49,10 +49,17 @@ LINK_LIBRARIES(${COMPLEX_LIBS})
SET_SOURCE_FILES_PROPERTIES(complex_nobuild.cxx PROPERTIES
HEADER_FILE_ONLY 1)
+# Test forcing a .c file to not build.
+# This makes sure a mixed language library is created
+# with header file only sources
+SET_SOURCE_FILES_PROPERTIES(complex_nobuild.c PROPERTIES
+ HEADER_FILE_ONLY 1)
+
ADD_EXECUTABLE(A A.cxx A.hh A.h A.txt)
ADD_EXECUTABLE(complex complex testcflags.c )
# Sub1/NameConflictTest.c Sub2/NameConflictTest.c)
-ADD_EXECUTABLE(complex.file complex.file.cxx complex_nobuild.cxx)
+ADD_EXECUTABLE(complex.file complex.file.cxx complex_nobuild.cxx
+ complex_nobuild.c)
IF(COMPLEX_TEST_CMAKELIB)
TARGET_LINK_LIBRARIES(complex CMakeLib cmsys cmexpat cmzlib cmlibarchive cmbzip2 cmcurl)
ENDIF(COMPLEX_TEST_CMAKELIB)
diff --git a/Tests/Complex/Executable/complex_nobuild.c b/Tests/Complex/Executable/complex_nobuild.c
new file mode 100644
index 0000000..6b3c2c1
--- /dev/null
+++ b/Tests/Complex/Executable/complex_nobuild.c
@@ -0,0 +1 @@
+#error "This file should not be compiled."
diff --git a/Tests/CustomCommand/CMakeLists.txt b/Tests/CustomCommand/CMakeLists.txt
index 13f4233..19e3c2c 100644
--- a/Tests/CustomCommand/CMakeLists.txt
+++ b/Tests/CustomCommand/CMakeLists.txt
@@ -423,3 +423,16 @@ ADD_CUSTOM_TARGET(DifferentName ALL
)
#
# </SameNameTest>
+
+# Per-config target name and generator expressions.
+ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../PerConfig PerConfig)
+ADD_CUSTOM_COMMAND(
+ OUTPUT perconfig.out
+ COMMAND ${PerConfig_COMMAND}
+ DEPENDS ${PerConfig_DEPENDS}
+ VERBATIM
+ )
+SET_PROPERTY(SOURCE perconfig.out PROPERTY SYMBOLIC 1)
+ADD_CUSTOM_TARGET(perconfig_target ALL
+ COMMAND ${CMAKE_COMMAND} -E echo "perconfig=$<TARGET_FILE:perconfig>" "config=$<CONFIGURATION>"
+ DEPENDS perconfig.out)
diff --git a/Tests/Jump/Library/Shared/CMakeLists.txt b/Tests/Jump/Library/Shared/CMakeLists.txt
index 46d4d36..4440577 100644
--- a/Tests/Jump/Library/Shared/CMakeLists.txt
+++ b/Tests/Jump/Library/Shared/CMakeLists.txt
@@ -1,8 +1,8 @@
ADD_LIBRARY(jumpShared SHARED jumpShared.cxx)
-IF(WIN32)
+IF(WIN32 OR CYGWIN)
SET(SHARED_MUST_BE_IN_EXE_DIR 1)
-ENDIF(WIN32)
+ENDIF()
IF(APPLE)
SET(SHARED_MUST_BE_IN_EXE_DIR 1)
diff --git a/Tests/PerConfig/CMakeLists.txt b/Tests/PerConfig/CMakeLists.txt
new file mode 100644
index 0000000..3a473b8
--- /dev/null
+++ b/Tests/PerConfig/CMakeLists.txt
@@ -0,0 +1,34 @@
+project(PerConfig C)
+
+# Targets with per-configuration names.
+ADD_LIBRARY(pcStatic STATIC pcStatic.c)
+SET_PROPERTY(TARGET pcStatic PROPERTY RELEASE_POSTFIX -opt)
+SET_PROPERTY(TARGET pcStatic PROPERTY DEBUG_POSTFIX -dbg)
+ADD_LIBRARY(pcShared SHARED pcShared.c)
+SET_PROPERTY(TARGET pcShared PROPERTY RELEASE_POSTFIX -opt)
+SET_PROPERTY(TARGET pcShared PROPERTY DEBUG_POSTFIX -dbg)
+SET_PROPERTY(TARGET pcShared PROPERTY VERSION 1.2)
+SET_PROPERTY(TARGET pcShared PROPERTY SOVERSION 3)
+IF(UNIX AND NOT CYGWIN)
+ SET(soname_file -DpcShared_soname_file=$<TARGET_SONAME_FILE:pcShared>)
+ENDIF()
+ADD_EXECUTABLE(perconfig perconfig.c)
+TARGET_LINK_LIBRARIES(perconfig pcStatic pcShared)
+SET_PROPERTY(TARGET perconfig PROPERTY RELEASE_POSTFIX -opt)
+SET_PROPERTY(TARGET perconfig PROPERTY DEBUG_POSTFIX -dbg)
+
+SET(PerConfig_COMMAND
+ ${CMAKE_COMMAND}
+ -Dconfiguration=$<CONFIGURATION>
+ -Dperconfig_file_dir=$<TARGET_FILE_DIR:perconfig>
+ -Dperconfig_file_name=$<TARGET_FILE_NAME:perconfig>
+ -Dperconfig_file=$<TARGET_FILE:perconfig>
+ -DpcStatic_file=$<TARGET_FILE:pcStatic>
+ -DpcStatic_linker_file=$<TARGET_LINKER_FILE:pcStatic>
+ -DpcShared_file=$<TARGET_FILE:pcShared>
+ -DpcShared_linker_file=$<TARGET_LINKER_FILE:pcShared>
+ ${soname_file}
+ -P ${PerConfig_SOURCE_DIR}/perconfig.cmake
+ )
+SET(PerConfig_COMMAND "${PerConfig_COMMAND}" PARENT_SCOPE)
+SET(PerConfig_DEPENDS ${PerConfig_SOURCE_DIR}/perconfig.cmake perconfig pcStatic pcShared)
diff --git a/Tests/Testing/pcShared.c b/Tests/PerConfig/pcShared.c
index b08fadc..b08fadc 100644
--- a/Tests/Testing/pcShared.c
+++ b/Tests/PerConfig/pcShared.c
diff --git a/Tests/Testing/pcShared.h b/Tests/PerConfig/pcShared.h
index 59a6ef4..59a6ef4 100644
--- a/Tests/Testing/pcShared.h
+++ b/Tests/PerConfig/pcShared.h
diff --git a/Tests/Testing/pcStatic.c b/Tests/PerConfig/pcStatic.c
index 7e1bf51..7e1bf51 100644
--- a/Tests/Testing/pcStatic.c
+++ b/Tests/PerConfig/pcStatic.c
diff --git a/Tests/Testing/perconfig.c b/Tests/PerConfig/perconfig.c
index d942d45..d942d45 100644
--- a/Tests/Testing/perconfig.c
+++ b/Tests/PerConfig/perconfig.c
diff --git a/Tests/Testing/driver.cmake b/Tests/PerConfig/perconfig.cmake
index 4a93acc..6a710ca 100644
--- a/Tests/Testing/driver.cmake
+++ b/Tests/PerConfig/perconfig.cmake
@@ -10,7 +10,7 @@ foreach(v
pcShared_linker_file
pcShared_soname_file
)
- message("${v}=${${v}}")
+ message(STATUS "${v}=${${v}}")
endforeach()
# Verify that file names match as expected.
diff --git a/Tests/Testing/CMakeLists.txt b/Tests/Testing/CMakeLists.txt
index f857407..815b52b 100644
--- a/Tests/Testing/CMakeLists.txt
+++ b/Tests/Testing/CMakeLists.txt
@@ -53,35 +53,7 @@ ADD_TEST(testing.1 ${Testing_BINARY_DIR}/bin/testing)
#
ADD_SUBDIRECTORY(Sub/Sub2)
-# Per-config target name test.
-ADD_LIBRARY(pcStatic STATIC pcStatic.c)
-SET_PROPERTY(TARGET pcStatic PROPERTY RELEASE_POSTFIX -opt)
-SET_PROPERTY(TARGET pcStatic PROPERTY DEBUG_POSTFIX -dbg)
-ADD_LIBRARY(pcShared SHARED pcShared.c)
-SET_PROPERTY(TARGET pcShared PROPERTY RELEASE_POSTFIX -opt)
-SET_PROPERTY(TARGET pcShared PROPERTY DEBUG_POSTFIX -dbg)
-SET_PROPERTY(TARGET pcShared PROPERTY VERSION 1.2)
-SET_PROPERTY(TARGET pcShared PROPERTY SOVERSION 3)
-IF(NOT WIN32)
- SET(soname_file -DpcShared_soname_file=$<TARGET_SONAME_FILE:pcShared>)
-ENDIF()
-ADD_EXECUTABLE(perconfig perconfig.c)
-TARGET_LINK_LIBRARIES(perconfig pcStatic pcShared)
-SET_PROPERTY(TARGET perconfig PROPERTY RELEASE_POSTFIX -opt)
-SET_PROPERTY(TARGET perconfig PROPERTY DEBUG_POSTFIX -dbg)
+# Per-config target name and generator expressions.
+ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../PerConfig PerConfig)
ADD_TEST(NAME testing.perconfig COMMAND perconfig)
-
-# Test using a driver script with generator expressions.
-ADD_TEST(NAME testing.driver
- COMMAND ${CMAKE_COMMAND}
- -Dconfiguration=$<CONFIGURATION>
- -Dperconfig_file_dir=$<TARGET_FILE_DIR:perconfig>
- -Dperconfig_file_name=$<TARGET_FILE_NAME:perconfig>
- -Dperconfig_file=$<TARGET_FILE:perconfig>
- -DpcStatic_file=$<TARGET_FILE:pcStatic>
- -DpcStatic_linker_file=$<TARGET_LINKER_FILE:pcStatic>
- -DpcShared_file=$<TARGET_FILE:pcShared>
- -DpcShared_linker_file=$<TARGET_LINKER_FILE:pcShared>
- ${soname_file}
- -P ${Testing_SOURCE_DIR}/driver.cmake
- )
+ADD_TEST(NAME testing.driver COMMAND ${PerConfig_COMMAND})
diff --git a/Tests/Testing/Sub/Sub2/CMakeLists.txt b/Tests/Testing/Sub/Sub2/CMakeLists.txt
index 3a7295d..fb9e861 100644
--- a/Tests/Testing/Sub/Sub2/CMakeLists.txt
+++ b/Tests/Testing/Sub/Sub2/CMakeLists.txt
@@ -3,3 +3,15 @@
#
ADD_EXECUTABLE(testing2 testing2.cxx)
ADD_TEST(testing.2 ${Testing_BINARY_DIR}/bin/testing2)
+
+add_test(NotCycle.a ${CMAKE_COMMAND} -E echo a)
+add_test(NotCycle.test1 ${CMAKE_COMMAND} -E echo test1)
+set_property(TEST NotCycle.test1 PROPERTY DEPENDS NotCycle.a)
+
+add_test(NotCycle.b ${CMAKE_COMMAND} -E echo b)
+add_test(NotCycle.test2 ${CMAKE_COMMAND} -E echo test2)
+set_property(TEST NotCycle.test2 PROPERTY DEPENDS NotCycle.b NotCycle.test1)
+
+add_test(NotCycle.c ${CMAKE_COMMAND} -E echo c)
+add_test(NotCycle.test3 ${CMAKE_COMMAND} -E echo test3)
+set_property(TEST NotCycle.test3 PROPERTY DEPENDS NotCycle.c NotCycle.test1 NotCycle.test2)
diff --git a/Tests/TestsWorkingDirectory/CMakeLists.txt b/Tests/TestsWorkingDirectory/CMakeLists.txt
new file mode 100644
index 0000000..01e6650
--- /dev/null
+++ b/Tests/TestsWorkingDirectory/CMakeLists.txt
@@ -0,0 +1,52 @@
+cmake_minimum_required(VERSION 2.6)
+project(TestsWorkingDirectoryProj)
+
+add_executable(WorkingDirectory main.c)
+
+enable_testing()
+
+set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin")
+
+add_test(NAME WorkingDirectory1 COMMAND WorkingDirectory)
+set_tests_properties(WorkingDirectory1 PROPERTIES
+ WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
+ PASS_REGULAR_EXPRESSION "Working directory: -->${CMAKE_BINARY_DIR}<--"
+)
+
+string(REGEX REPLACE "/[^/]*$" "" _parent_dir "${CMAKE_BINARY_DIR}")
+
+add_test(NAME WorkingDirectory2 COMMAND WorkingDirectory)
+set_tests_properties(WorkingDirectory2 PROPERTIES
+ WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/.."
+ PASS_REGULAR_EXPRESSION "Working directory: -->${_parent_dir}<--"
+)
+
+get_filename_component(_default_cwd "${EXECUTABLE_OUTPUT_PATH}" PATH)
+
+# FIXME: How to deal with /debug, /release, etc. with VS or XCode?
+if(${CMAKE_GENERATOR} MATCHES "Makefiles")
+add_test(WorkingDirectory3 ${EXECUTABLE_OUTPUT_PATH}/WorkingDirectory)
+set_tests_properties(WorkingDirectory3 PROPERTIES
+ PASS_REGULAR_EXPRESSION "Working directory: -->${_default_cwd}<--"
+)
+endif()
+
+add_test(NAME WorkingDirectory4 WORKING_DIRECTORY ${CMAKE_BINARY_DIR} COMMAND WorkingDirectory)
+set_tests_properties(WorkingDirectory4 PROPERTIES
+ PASS_REGULAR_EXPRESSION "Working directory: -->${CMAKE_BINARY_DIR}<--"
+)
+
+string(REGEX REPLACE "/[^/]*$" "" _parent_dir "${CMAKE_BINARY_DIR}")
+
+add_test(NAME WorkingDirectory5 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/.. COMMAND WorkingDirectory)
+set_tests_properties(WorkingDirectory5 PROPERTIES
+ PASS_REGULAR_EXPRESSION "Working directory: -->${_parent_dir}<--"
+)
+
+# FIXME: How to deal with /debug, /release, etc. with VS or XCode?
+if(${CMAKE_GENERATOR} MATCHES "Makefiles")
+add_test(WorkingDirectory6 ${EXECUTABLE_OUTPUT_PATH}/WorkingDirectory WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/..)
+set_tests_properties(WorkingDirectory6 PROPERTIES
+ PASS_REGULAR_EXPRESSION "Working directory: -->${_default_cwd}<--"
+)
+endif()
diff --git a/Tests/TestsWorkingDirectory/main.c b/Tests/TestsWorkingDirectory/main.c
new file mode 100644
index 0000000..ad5eb30
--- /dev/null
+++ b/Tests/TestsWorkingDirectory/main.c
@@ -0,0 +1,66 @@
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if defined(_WIN32) && (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__) || defined(__MINGW32__))
+
+#include <io.h>
+#include <direct.h>
+
+#if defined(__WATCOMC__)
+#include <direct.h>
+#define _getcwd getcwd
+#endif
+
+static const char* Getcwd(char* buf, unsigned int len)
+{
+ const char* ret = _getcwd(buf, len);
+ char* p = NULL;
+ if(!ret)
+ {
+ fprintf(stderr, "No current working directory.\n");
+ abort();
+ }
+ // make sure the drive letter is capital
+ if(strlen(buf) > 1 && buf[1] == ':')
+ {
+ buf[0] = toupper(buf[0]);
+ }
+ for(p = buf; *p; ++p)
+ {
+ if(*p == '\\')
+ {
+ *p = '/';
+ }
+ }
+ return ret;
+}
+
+#else
+#include <sys/types.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+static const char* Getcwd(char* buf, unsigned int len)
+{
+ const char* ret = getcwd(buf, len);
+ if(!ret)
+ {
+ fprintf(stderr, "No current working directory\n");
+ abort();
+ }
+ return ret;
+}
+
+#endif
+
+int main(int argc, char *argv[])
+{
+ char buf[2048];
+ const char *cwd = Getcwd(buf, sizeof(buf));
+
+ fprintf(stdout, "Working directory: -->%s<--", cwd);
+
+ return 0;
+}
diff --git a/Tests/TryCompile/CMakeLists.txt b/Tests/TryCompile/CMakeLists.txt
index a57498f..90c2cfc 100644
--- a/Tests/TryCompile/CMakeLists.txt
+++ b/Tests/TryCompile/CMakeLists.txt
@@ -226,3 +226,9 @@ UNSET(CXX_BOGUS_FLAG CACHE)
INCLUDE(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG(${CXX_DD}-_this_is_not_a_flag_ CXX_BOGUS_FLAG)
TEST_FAIL(CXX_BOGUS_FLAG "CHECK_CXX_COMPILER_FLAG() succeeded, but should have failed")
+
+IF("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
+ UNSET(C_STRICT_PROTOTYPES CACHE)
+ CHECK_C_COMPILER_FLAG("-Werror;-Wstrict-prototypes" C_STRICT_PROTOTYPES)
+ TEST_ASSERT(C_STRICT_PROTOTYPES "CHECK_C_COMPILER_FLAG failed -Werror -Wstrict-prototypes")
+ENDIF()