[Cmake-commits] CMake branch, next, updated. v3.6.2-1868-gb4ab772
Roger Leigh
rleigh at codelibre.net
Thu Sep 8 16:57:03 EDT 2016
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via b4ab772483a971880e4e2baa844dfa40124e8332 (commit)
via 30d13fa92cafd44e84a5e3b95373a21f2373afce (commit)
via efe622be144df37eeb0d09c924cd9ccd38b91b09 (commit)
from 6f43ab3049540f3a0c62c50d9e6b43f10fa57897 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b4ab772483a971880e4e2baa844dfa40124e8332
commit b4ab772483a971880e4e2baa844dfa40124e8332
Merge: 6f43ab3 30d13fa
Author: Roger Leigh <rleigh at codelibre.net>
AuthorDate: Thu Sep 8 16:57:00 2016 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Sep 8 16:57:00 2016 -0400
Merge topic 'bzip2-imported-targets' into next
30d13fa9 Tests: Add FindBZip2 unit tests
efe622be FindBZip2: Add imported target
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=30d13fa92cafd44e84a5e3b95373a21f2373afce
commit 30d13fa92cafd44e84a5e3b95373a21f2373afce
Author: Roger Leigh <rleigh at codelibre.net>
AuthorDate: Thu Sep 8 21:28:17 2016 +0100
Commit: Roger Leigh <rleigh at codelibre.net>
CommitDate: Thu Sep 8 21:54:43 2016 +0100
Tests: Add FindBZip2 unit tests
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 8293286..aeff249 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1356,6 +1356,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
add_subdirectory(FindBoost)
endif()
+ if(CMake_TEST_FindBZip2)
+ add_subdirectory(FindBZip2)
+ endif()
+
if(CMake_TEST_FindGSL)
add_subdirectory(FindGSL)
endif()
diff --git a/Tests/FindBZip2/CMakeLists.txt b/Tests/FindBZip2/CMakeLists.txt
new file mode 100644
index 0000000..0eb3b99
--- /dev/null
+++ b/Tests/FindBZip2/CMakeLists.txt
@@ -0,0 +1,10 @@
+add_test(NAME FindBZip2.Test COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindBZip2/Test"
+ "${CMake_BINARY_DIR}/Tests/FindBZip2/Test"
+ ${build_generator_args}
+ --build-project TestFindBZip2
+ --build-options ${build_options}
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
diff --git a/Tests/FindBZip2/Test/CMakeLists.txt b/Tests/FindBZip2/Test/CMakeLists.txt
new file mode 100644
index 0000000..e9cb618
--- /dev/null
+++ b/Tests/FindBZip2/Test/CMakeLists.txt
@@ -0,0 +1,16 @@
+cmake_minimum_required(VERSION 3.4)
+project(TestFindBZip2 C)
+include(CTest)
+
+find_package(BZip2 REQUIRED)
+
+add_definitions(-DCMAKE_EXPECTED_BZip2_VERSION="${BZip2_VERSION_STRING}")
+
+add_executable(test_tgt main.c)
+target_link_libraries(test_tgt BZip2::BZip2)
+add_test(NAME test_tgt COMMAND test_tgt)
+
+add_executable(test_var main.c)
+target_include_directories(test_var PRIVATE ${BZIP2_INCLUDE_DIRS})
+target_link_libraries(test_var PRIVATE ${BZIP2_LIBRARIES})
+add_test(NAME test_var COMMAND test_var)
diff --git a/Tests/FindBZip2/Test/main.c b/Tests/FindBZip2/Test/main.c
new file mode 100644
index 0000000..f8d1ddc
--- /dev/null
+++ b/Tests/FindBZip2/Test/main.c
@@ -0,0 +1,23 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <bzlib.h>
+
+int main()
+{
+ int chunksize = 1024;
+ FILE *file = fopen("test.bzip2", "wb");
+ char *buf = malloc(sizeof(char) * chunksize);
+ int error, rsize;
+ unsigned int in, out;
+ BZFILE *bzfile = BZ2_bzWriteOpen(&error, file, 64, 1, 10);
+
+ /* Don't actually write anything for the purposes of the test */
+
+ BZ2_bzWriteClose(&error, bzfile, 1, &in, &out);
+ free(buf);
+ fclose(file);
+
+ remove("test.bzip2");
+
+ return 0;
+}
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=efe622be144df37eeb0d09c924cd9ccd38b91b09
commit efe622be144df37eeb0d09c924cd9ccd38b91b09
Author: Roger Leigh <rleigh at codelibre.net>
AuthorDate: Thu Sep 8 21:16:09 2016 +0100
Commit: Roger Leigh <rleigh at codelibre.net>
CommitDate: Thu Sep 8 21:16:09 2016 +0100
FindBZip2: Add imported target
diff --git a/Modules/FindBZip2.cmake b/Modules/FindBZip2.cmake
index b670025..ca7761d 100644
--- a/Modules/FindBZip2.cmake
+++ b/Modules/FindBZip2.cmake
@@ -64,6 +64,31 @@ if (BZIP2_FOUND)
set(CMAKE_REQUIRED_LIBRARIES ${BZIP2_LIBRARIES})
CHECK_SYMBOL_EXISTS(BZ2_bzCompressInit "bzlib.h" BZIP2_NEED_PREFIX)
cmake_pop_check_state()
+
+ if(NOT TARGET BZip2::BZip2)
+ add_library(BZip2::BZip2 UNKNOWN IMPORTED)
+ set_target_properties(BZip2::BZip2 PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${BZIP2_INCLUDE_DIRS}")
+
+ if(BZIP2_LIBRARY_RELEASE)
+ set_property(TARGET BZip2::BZip2 APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS RELEASE)
+ set_target_properties(BZip2::BZip2 PROPERTIES
+ IMPORTED_LOCATION_RELEASE "${BZIP2_LIBRARY_RELEASE}")
+ endif()
+
+ if(BZIP2_LIBRARY_DEBUG)
+ set_property(TARGET BZip2::BZip2 APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS DEBUG)
+ set_target_properties(BZip2::BZip2 PROPERTIES
+ IMPORTED_LOCATION_DEBUG "${BZIP2_LIBRARY_DEBUG}")
+ endif()
+
+ if(NOT BZIP2_LIBRARY_RELEASE AND NOT BZIP2_LIBRARY_DEBUG)
+ set_property(TARGET BZip2::BZip2 APPEND PROPERTY
+ IMPORTED_LOCATION "${BZIP2_LIBRARY}")
+ endif()
+ endif()
endif ()
mark_as_advanced(BZIP2_INCLUDE_DIR)
-----------------------------------------------------------------------
Summary of changes:
Modules/FindBZip2.cmake | 25 +++++++++++++++++++++++++
Tests/CMakeLists.txt | 4 ++++
Tests/{FindICU => FindBZip2}/CMakeLists.txt | 8 ++++----
Tests/FindBZip2/Test/CMakeLists.txt | 16 ++++++++++++++++
Tests/FindBZip2/Test/main.c | 23 +++++++++++++++++++++++
5 files changed, 72 insertions(+), 4 deletions(-)
copy Tests/{FindICU => FindBZip2}/CMakeLists.txt (54%)
create mode 100644 Tests/FindBZip2/Test/CMakeLists.txt
create mode 100644 Tests/FindBZip2/Test/main.c
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list