5.5.3. Sample CMakeLists - 5.2 English - 57404

AOCL User Guide (57404)

Document ID
57404
Release Date
2025-12-29
Version
5.2 English

A sample CMakeLists file to integrate your application with AOCL-Compression library is shown here. Paths to include and lib folders in the installed AOCL-Compression installed package are provided and the application links to AOCL-Compression library.

cmake_minimum_required(VERSION 3.18.0)
project(MY-APPLICATION CXX C)
message(STATUS "Building application that uses AOCL-Compression library")

# Set paths
set(AOCL_COMPRESSION_INSTALL_DIR "path/to/installed/package")
set(AOCL_COMPRESSION_INC_DIR "${AOCL_COMPRESSION_INSTALL_DIR}/include" CACHE STRING "include directory path of AOCL-Compression library")
set(AOCL_COMPRESSION_LIB_DIR "${AOCL_COMPRESSION_INSTALL_DIR}/lib" CACHE STRING "lib directory path of AOCL-Compression library")
set(lib_name aocl_compression)
set(exe_name my_application)

# Build application
set(my_sources "list of source files for the application")
add_executable(${exe_name} ${my_sources})
target_include_directories(${exe_name} PRIVATE ${AOCL_COMPRESSION_INC_DIR})
target_link_directories(${exe_name} PRIVATE ${AOCL_COMPRESSION_LIB_DIR})
target_link_libraries(${exe_name} ${lib_name})