diff options
Diffstat (limited to 'Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/windows-notfile.cmake')
-rw-r--r-- | Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/windows-notfile.cmake | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/windows-notfile.cmake b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/windows-notfile.cmake new file mode 100644 index 0000000..6665a3b --- /dev/null +++ b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/windows-notfile.cmake @@ -0,0 +1,28 @@ +enable_language(C) + +file(WRITE "${CMAKE_BINARY_DIR}/test.c" "__declspec(dllexport) void test(void) {}\n") +file(WRITE "${CMAKE_BINARY_DIR}/main.c" [[__declspec(dllimport) extern void test(void); + +int main(void) +{ + test(); + return 0; +} +]]) + +add_library(test SHARED "${CMAKE_BINARY_DIR}/test.c") +add_executable(exe "${CMAKE_BINARY_DIR}/main.c") +target_link_libraries(exe PRIVATE test) + +install(TARGETS exe DESTINATION bin) + +install(CODE [[ + file(MAKE_DIRECTORY "${CMAKE_INSTALL_PREFIX}/bin/$<TARGET_FILE_NAME:test>") + file(GET_RUNTIME_DEPENDENCIES + EXECUTABLES + "${CMAKE_INSTALL_PREFIX}/bin/$<TARGET_FILE_NAME:exe>" + PRE_INCLUDE_REGEXES "^(lib)?test\\.dll$" + PRE_EXCLUDE_REGEXES ".*" + ) + message(FATAL_ERROR "This message should not be displayed") + ]]) |