CMakeLists.txt 795 B

12345678910111213141516171819202122232425
  1. project(bzip2)
  2. # Disable warnings to avoid changing 3rd party code.
  3. if(CMAKE_C_COMPILER_ID MATCHES
  4. "^(GNU|LCC|Clang|AppleClang|IBMClang|XLClang|XL|VisualAge|SunPro|HP|Intel|IntelLLVM|NVHPC)$")
  5. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w")
  6. elseif(CMAKE_C_COMPILER_ID STREQUAL "PathScale")
  7. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -woffall")
  8. endif()
  9. # Activate POSIX APIs.
  10. if(CMAKE_SYSTEM_NAME MATCHES "^(AIX|OS400)$")
  11. add_definitions(-D_ALL_SOURCE)
  12. endif()
  13. if(NOT CMAKE_SYSTEM_NAME MATCHES "BSD|Darwin|Windows")
  14. add_definitions(-D_XOPEN_SOURCE=600)
  15. endif()
  16. add_definitions(-D_FILE_OFFSET_BITS=64)
  17. add_library(cmbzip2
  18. blocksort.c huffman.c crctable.c randtable.c compress.c decompress.c bzlib.c)
  19. if(WIN32 AND CMake_BUILD_PCH)
  20. target_precompile_headers(cmbzip2 PRIVATE "bzlib.h")
  21. endif()