diff options
-rw-r--r-- | Help/release/3.11.rst | 7 | ||||
-rw-r--r-- | Help/release/dev/alsa-target.rst | 4 | ||||
-rw-r--r-- | Modules/FindALSA.cmake | 39 | ||||
-rw-r--r-- | Source/CMakeLists.txt | 4 | ||||
-rw-r--r-- | Source/CMakeVersion.cmake | 2 | ||||
-rw-r--r-- | Source/cmSystemTools.cxx | 10 | ||||
-rw-r--r-- | Source/cmSystemTools.h | 10 | ||||
-rw-r--r-- | Source/cmTimestamp.cxx | 3 | ||||
-rw-r--r-- | Templates/TestDriver.cxx.in | 2 | ||||
-rw-r--r-- | Tests/CMakeLists.txt | 4 | ||||
-rw-r--r-- | Tests/FindALSA/CMakeLists.txt | 10 | ||||
-rw-r--r-- | Tests/FindALSA/Test/CMakeLists.txt | 16 | ||||
-rw-r--r-- | Tests/FindALSA/Test/main.c | 10 |
13 files changed, 100 insertions, 21 deletions
diff --git a/Help/release/3.11.rst b/Help/release/3.11.rst index 971b3e2..214da0d 100644 --- a/Help/release/3.11.rst +++ b/Help/release/3.11.rst @@ -298,3 +298,10 @@ Changes made since CMake 3.11.0 include the following. :prop_sf:`SKIP_AUTOUIC` on their generated files. These files never need to be processed by moc or uic, and we must say so explicitly to account for policy :policy:`CMP0071`. + +3.11.3 +------ + +* CMake 3.11.0 introduced support for resolving symbolic links on + Windows in code paths that typically do so on UNIX. This has been + reverted due to breakage on ``subst`` drives. diff --git a/Help/release/dev/alsa-target.rst b/Help/release/dev/alsa-target.rst new file mode 100644 index 0000000..e970580 --- /dev/null +++ b/Help/release/dev/alsa-target.rst @@ -0,0 +1,4 @@ +alsa-target +----------- + +* The :module:`FindALSA` module now provides imported targets. diff --git a/Modules/FindALSA.cmake b/Modules/FindALSA.cmake index fa9a434..c9cfd60 100644 --- a/Modules/FindALSA.cmake +++ b/Modules/FindALSA.cmake @@ -9,20 +9,36 @@ # # Find the alsa libraries (asound) # -# :: +# IMPORTED Targets +# ^^^^^^^^^^^^^^^^ # -# This module defines the following variables: -# ALSA_FOUND - True if ALSA_INCLUDE_DIR & ALSA_LIBRARY are found -# ALSA_LIBRARIES - Set when ALSA_LIBRARY is found -# ALSA_INCLUDE_DIRS - Set when ALSA_INCLUDE_DIR is found +# This module defines :prop_tgt:`IMPORTED` target ``ALSA::ALSA``, if +# ALSA has been found. # +# Result Variables +# ^^^^^^^^^^^^^^^^ # +# This module defines the following variables: # -# :: +# ``ALSA_FOUND`` +# True if ALSA_INCLUDE_DIR & ALSA_LIBRARY are found # -# ALSA_INCLUDE_DIR - where to find asoundlib.h, etc. -# ALSA_LIBRARY - the asound library -# ALSA_VERSION_STRING - the version of alsa found (since CMake 2.8.8) +# ``ALSA_LIBRARIES`` +# List of libraries when using ALSA. +# +# ``ALSA_INCLUDE_DIRS`` +# Where to find the ALSA headers. +# +# Cache variables +# ^^^^^^^^^^^^^^^ +# +# The following cache variables may also be set: +# +# ``ALSA_INCLUDE_DIR`` +# the ALSA include directory +# +# ``ALSA_LIBRARY`` +# the absolute path of the asound library find_path(ALSA_INCLUDE_DIR NAMES alsa/asoundlib.h DOC "The ALSA (asound) include directory" @@ -47,6 +63,11 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(ALSA if(ALSA_FOUND) set( ALSA_LIBRARIES ${ALSA_LIBRARY} ) set( ALSA_INCLUDE_DIRS ${ALSA_INCLUDE_DIR} ) + if(NOT TARGET ALSA::ALSA) + add_library(ALSA::ALSA UNKNOWN IMPORTED) + set_target_properties(ALSA::ALSA PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${ALSA_INCLUDE_DIRS}") + set_property(TARGET ALSA::ALSA APPEND PROPERTY IMPORTED_LOCATION "${ALSA_LIBRARY}") + endif() endif() mark_as_advanced(ALSA_INCLUDE_DIR ALSA_LIBRARY) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 316d50b..30bef74 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -957,8 +957,8 @@ if(CYGWIN) endif() if(WIN32 OR (CYGWIN AND LibUUID_FOUND)) set(CPACK_SRCS ${CPACK_SRCS} - CPack/Wix/cmCMakeToWixPath.cxx - CPack/Wix/cmCMakeToWixPath.h + CPack/WiX/cmCMakeToWixPath.cxx + CPack/WiX/cmCMakeToWixPath.h CPack/WiX/cmCPackWIXGenerator.cxx CPack/WiX/cmCPackWIXGenerator.h CPack/WiX/cmWIXAccessControlList.cxx diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 0171ae8..a717d6a 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 11) -set(CMake_VERSION_PATCH 20180531) +set(CMake_VERSION_PATCH 20180601) #set(CMake_VERSION_RC 1) diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 169b525..cf1068f 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -949,10 +949,12 @@ cmSystemTools::WindowsFileRetry cmSystemTools::GetWindowsFileRetry() } return retry; } +#endif -std::string cmSystemTools::GetRealPath(const std::string& path, - std::string* errorMessage) +std::string cmSystemTools::GetRealPathResolvingWindowsSubst( + const std::string& path, std::string* errorMessage) { +#ifdef _WIN32 // uv_fs_realpath uses Windows Vista API so fallback to kwsys if not found std::string resolved_path; uv_fs_t req; @@ -981,8 +983,10 @@ std::string cmSystemTools::GetRealPath(const std::string& path, resolved_path = path; } return resolved_path; -} +#else + return cmsys::SystemTools::GetRealPath(path, errorMessage); #endif +} void cmSystemTools::InitializeLibUV() { diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index a53afde..4390c86 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -500,12 +500,14 @@ public: unsigned int Delay; }; static WindowsFileRetry GetWindowsFileRetry(); - - /** Get the real path for a given path, removing all symlinks. */ - static std::string GetRealPath(const std::string& path, - std::string* errorMessage = 0); #endif + /** Get the real path for a given path, removing all symlinks. + This variant of GetRealPath also works on Windows but will + resolve subst drives too. */ + static std::string GetRealPathResolvingWindowsSubst( + const std::string& path, std::string* errorMessage = nullptr); + /** Perform one-time initialization of libuv. */ static void InitializeLibUV(); diff --git a/Source/cmTimestamp.cxx b/Source/cmTimestamp.cxx index f1e9283..14cf6e9 100644 --- a/Source/cmTimestamp.cxx +++ b/Source/cmTimestamp.cxx @@ -33,7 +33,8 @@ std::string cmTimestamp::FileModificationTime(const char* path, const std::string& formatString, bool utcFlag) { - std::string real_path = cmSystemTools::GetRealPath(path); + std::string real_path = + cmSystemTools::GetRealPathResolvingWindowsSubst(path); if (!cmsys::SystemTools::FileExists(real_path)) { return std::string(); diff --git a/Templates/TestDriver.cxx.in b/Templates/TestDriver.cxx.in index d71f290..c58ef71 100644 --- a/Templates/TestDriver.cxx.in +++ b/Templates/TestDriver.cxx.in @@ -48,7 +48,7 @@ static char* lowercase(const char* string) if (new_string == NULL) { /* NOLINT */ return NULL; /* NOLINT */ } - strncpy(new_string, string, stringSize); + strcpy(new_string, string); for (p = new_string; *p != 0; ++p) { *p = CM_CAST(char, tolower(*p)); } diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 0e94388..886e392 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1368,6 +1368,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release endif() endif() + if(CMake_TEST_FindALSA) + add_subdirectory(FindALSA) + endif() + if(CMake_TEST_CUDA) add_subdirectory(Cuda) add_subdirectory(CudaOnly) diff --git a/Tests/FindALSA/CMakeLists.txt b/Tests/FindALSA/CMakeLists.txt new file mode 100644 index 0000000..891f7a4 --- /dev/null +++ b/Tests/FindALSA/CMakeLists.txt @@ -0,0 +1,10 @@ +add_test(NAME FindALSA.Test COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindALSA/Test" + "${CMake_BINARY_DIR}/Tests/FindALSA/Test" + ${build_generator_args} + --build-project TestFindALSA + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) diff --git a/Tests/FindALSA/Test/CMakeLists.txt b/Tests/FindALSA/Test/CMakeLists.txt new file mode 100644 index 0000000..2829740 --- /dev/null +++ b/Tests/FindALSA/Test/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.10) +project(TestFindALSA C) +include(CTest) + +find_package(ALSA REQUIRED) + +add_definitions(-DCMAKE_EXPECTED_ALSA_VERSION="${ALSA_VERSION_STRING}") + +add_executable(test_tgt main.c) +target_link_libraries(test_tgt ALSA::ALSA) +add_test(NAME test_tgt COMMAND test_tgt) + +add_executable(test_var main.c) +target_include_directories(test_var PRIVATE ${ALSA_INCLUDE_DIRS}) +target_link_libraries(test_var PRIVATE ${ALSA_LIBRARIES}) +add_test(NAME test_var COMMAND test_var) diff --git a/Tests/FindALSA/Test/main.c b/Tests/FindALSA/Test/main.c new file mode 100644 index 0000000..d3303d0 --- /dev/null +++ b/Tests/FindALSA/Test/main.c @@ -0,0 +1,10 @@ +#include <alsa/global.h> +#include <stdio.h> +#include <string.h> + +int main() +{ + printf("Found ALSA version %s, expected version %s\n", + snd_asoundlib_version(), CMAKE_EXPECTED_ALSA_VERSION); + return strcmp(snd_asoundlib_version(), CMAKE_EXPECTED_ALSA_VERSION); +} |