diff options
| author | Silvio <silvio.traversaro@iit.it> | 2017-03-05 16:48:00 +0100 |
|---|---|---|
| committer | Silvio <silvio.traversaro@iit.it> | 2017-03-05 17:09:23 +0100 |
| commit | d22f7719cb6a610be6cc20cbfbb79698177360cd (patch) | |
| tree | 5eaf7a4bd401fc600047a7bf0b792f49fb67a702 | |
| parent | e32762ce3ccbd10af00fed78995fb442931e55bb (diff) | |
| download | dlfcn-win32-d22f7719cb6a610be6cc20cbfbb79698177360cd.tar.gz dlfcn-win32-d22f7719cb6a610be6cc20cbfbb79698177360cd.tar.bz2 dlfcn-win32-d22f7719cb6a610be6cc20cbfbb79698177360cd.zip | |
Add testing of CMake exported targets
| -rw-r--r-- | .appveyor.yml | 13 | ||||
| -rw-r--r-- | cmake-test/CMakeLists.txt | 14 | ||||
| -rw-r--r-- | test.c | 1 |
3 files changed, 27 insertions, 1 deletions
diff --git a/.appveyor.yml b/.appveyor.yml index fd488ba..d97a44e 100644 --- a/.appveyor.yml +++ b/.appveyor.yml | |||
| @@ -52,7 +52,7 @@ build_script: | |||
| 52 | - ps: if($env:PLATFORM -eq "x64") { $env:CMAKE_GEN_SUFFIX=" Win64" } | 52 | - ps: if($env:PLATFORM -eq "x64") { $env:CMAKE_GEN_SUFFIX=" Win64" } |
| 53 | - md build | 53 | - md build |
| 54 | - cd build | 54 | - cd build |
| 55 | - cmake "-G%GENERATOR%%CMAKE_GEN_SUFFIX%" -DBUILD_SHARED_LIBS=%BUILD_SHARED_LIBS% -DBUILD_TESTS=ON .. | 55 | - cmake "-G%GENERATOR%%CMAKE_GEN_SUFFIX%" -DBUILD_SHARED_LIBS=%BUILD_SHARED_LIBS% -DBUILD_TESTS=ON -DCMAKE_INSTALL_PREFIX="./install" .. |
| 56 | - cmake --build . --config "%CONFIGURATION%" | 56 | - cmake --build . --config "%CONFIGURATION%" |
| 57 | 57 | ||
| 58 | test_script: | 58 | test_script: |
| @@ -60,4 +60,15 @@ test_script: | |||
| 60 | 60 | ||
| 61 | after_test: | 61 | after_test: |
| 62 | - cmake --build . --config "%CONFIGURATION%" --target INSTALL | 62 | - cmake --build . --config "%CONFIGURATION%" --target INSTALL |
| 63 | # Test also the use of dlfcn-win32 from an external CMake project | ||
| 64 | # Append the instllation directory of dlfcn-win32 to CMAKE_PREFIX_PATH to make sure that the CMake project is found | ||
| 65 | - set CMAKE_PREFIX_PATH=%APPVEYOR_BUILD_FOLDER%/build/install | ||
| 66 | # Append the bin installation directory of dlfcn-win32 to the path to make sure that .dll are found | ||
| 67 | - set PATH=%PATH%;%APPVEYOR_BUILD_FOLDER%/build/install/bin | ||
| 68 | - cd ../cmake-test | ||
| 69 | - md build | ||
| 70 | - cd build | ||
| 71 | - cmake "-G%GENERATOR%%CMAKE_GEN_SUFFIX%" -DBUILD_SHARED_LIBS=%BUILD_SHARED_LIBS% -DBUILD_TESTS=ON .. | ||
| 72 | - cmake --build . --config "%CONFIGURATION%" | ||
| 73 | - ctest --output-on-failure --build-config "%CONFIGURATION%" | ||
| 63 | 74 | ||
diff --git a/cmake-test/CMakeLists.txt b/cmake-test/CMakeLists.txt new file mode 100644 index 0000000..532f2b8 --- /dev/null +++ b/cmake-test/CMakeLists.txt | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | # Simple CMake project to test the use of dlfcn-win32 | ||
| 2 | # imported target. The test compiled is the same compiled | ||
| 3 | # as part of the main dlfcn-win32 project | ||
| 4 | |||
| 5 | cmake_minimum_required(VERSION 3.0) | ||
| 6 | |||
| 7 | find_package(dlfcn-win32 REQUIRED) | ||
| 8 | |||
| 9 | add_library(testdll SHARED ../testdll.c) | ||
| 10 | set_target_properties(testdll PROPERTIES PREFIX "") | ||
| 11 | add_executable(t_dlfcn ../test.c) | ||
| 12 | target_link_libraries(t_dlfcn dlfcn-win32::dl) | ||
| 13 | enable_testing() | ||
| 14 | add_test(NAME t_dlfcn COMMAND t_dlfcn) | ||
| @@ -24,6 +24,7 @@ | |||
| 24 | #include <crtdbg.h> | 24 | #include <crtdbg.h> |
| 25 | #endif | 25 | #endif |
| 26 | #include <stdio.h> | 26 | #include <stdio.h> |
| 27 | #include <string.h> | ||
| 27 | #include "dlfcn.h" | 28 | #include "dlfcn.h" |
| 28 | 29 | ||
| 29 | /* If these dlclose's fails, we don't care as the handles are going to be | 30 | /* If these dlclose's fails, we don't care as the handles are going to be |
