-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(#13667) bzip2: Conan V2 improvements
* bzip2: Conan V2 improvments Use export patches method. Safely delete fPIC option. Use Python F-Strings. * Remove redundant package name from topics * Modernize the CMakeLists.txt file * Fix spacing * Use can_run in test package * Incorporate changes from #13703 * More fixes * Remove use of conan_version * Update recipes/bzip2/all/test_package/CMakeLists.txt Co-authored-by: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Co-authored-by: SpaceIm <30052553+SpaceIm@users.noreply.github.com>
- Loading branch information
1 parent
2d9b4b8
commit 63083cc
Showing
6 changed files
with
77 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,41 @@ | ||
cmake_minimum_required(VERSION 3.4) | ||
project(bzip2 C) | ||
project(bzip2 LANGUAGES C) | ||
|
||
include(GNUInstallDirs) | ||
|
||
if(MSVC OR MSVC90 OR MSVC10) | ||
set(MSVC ON) | ||
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) | ||
endif() | ||
|
||
set(SOURCE_SUBFOLDER ${CMAKE_CURRENT_SOURCE_DIR}/src) | ||
set(BZ2_LIBRARY bz2) | ||
|
||
option(BZ2_BUILD_EXE ON) | ||
|
||
set(BZ2_TARGETS ${BZ2_LIBRARY}) | ||
|
||
add_library(${BZ2_LIBRARY} ${SOURCE_SUBFOLDER}/blocksort.c | ||
${SOURCE_SUBFOLDER}/bzlib.c | ||
${SOURCE_SUBFOLDER}/compress.c | ||
${SOURCE_SUBFOLDER}/crctable.c | ||
${SOURCE_SUBFOLDER}/decompress.c | ||
${SOURCE_SUBFOLDER}/huffman.c | ||
${SOURCE_SUBFOLDER}/randtable.c | ||
${SOURCE_SUBFOLDER}/bzlib.h | ||
${SOURCE_SUBFOLDER}/bzlib_private.h) | ||
target_include_directories(${BZ2_LIBRARY} PRIVATE ${SOURCE_SUBFOLDER}) | ||
option(BZ2_BUILD_EXE "Build bzip2 command-line utility" ON) | ||
|
||
add_library( | ||
bz2 | ||
${BZ2_SRC_DIR}/blocksort.c | ||
${BZ2_SRC_DIR}/bzlib.c | ||
${BZ2_SRC_DIR}/compress.c | ||
${BZ2_SRC_DIR}/crctable.c | ||
${BZ2_SRC_DIR}/decompress.c | ||
${BZ2_SRC_DIR}/huffman.c | ||
${BZ2_SRC_DIR}/randtable.c | ||
) | ||
|
||
target_include_directories(bz2 PUBLIC ${BZ2_SRC_DIR}) | ||
set_target_properties( | ||
bz2 | ||
PROPERTIES | ||
PUBLIC_HEADER "${BZ2_SRC_DIR}/bzlib.h" | ||
SOVERSION ${BZ2_VERSION_MAJOR} | ||
VERSION ${BZ2_VERSION_STRING} | ||
WINDOWS_EXPORT_ALL_SYMBOLS ON | ||
) | ||
|
||
install( | ||
TARGETS bz2 | ||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} | ||
) | ||
|
||
if(BZ2_BUILD_EXE) | ||
add_executable(${CMAKE_PROJECT_NAME} ${SOURCE_SUBFOLDER}/bzip2.c) | ||
target_link_libraries(${CMAKE_PROJECT_NAME} ${BZ2_LIBRARY}) | ||
target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE ${SOURCE_SUBFOLDER}) | ||
list(APPEND BZ2_TARGETS ${CMAKE_PROJECT_NAME}) | ||
add_executable(bzip2 ${BZ2_SRC_DIR}/bzip2.c) | ||
target_link_libraries(bzip2 PRIVATE bz2) | ||
install(TARGETS bzip2 DESTINATION ${CMAKE_INSTALL_BINDIR}) | ||
endif() | ||
|
||
set_target_properties(${BZ2_LIBRARY} PROPERTIES VERSION ${BZ2_VERSION_STRING} SOVERSION ${BZ2_VERSION_MAJOR}) | ||
|
||
install(TARGETS ${BZ2_TARGETS} | ||
BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) | ||
|
||
install(FILES ${SOURCE_SUBFOLDER}/bzlib.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,8 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
project(test_package LANGUAGES C) | ||
project(test_package) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup(TARGETS) | ||
|
||
find_package(BZip2 REQUIRED) | ||
message("BZIP2_FOUND: ${BZIP2_FOUND}") | ||
message("BZIP2_NEED_PREFIX: ${BZIP2_NEED_PREFIX}") | ||
message("BZIP2_INCLUDE_DIRS: ${BZIP2_INCLUDE_DIRS}") | ||
message("BZIP2_INCLUDE_DIR: ${BZIP2_INCLUDE_DIR}") | ||
message("BZIP2_LIBRARIES: ${BZIP2_LIBRARIES}") | ||
message("BZIP2_VERSION_STRING: ${BZIP2_VERSION_STRING}") | ||
|
||
add_executable(test_package ../test_package/test_package.c) | ||
target_link_libraries(test_package PRIVATE BZip2::BZip2) | ||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package | ||
${CMAKE_CURRENT_BINARY_DIR}/test_package) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters