Skip to content

Commit

Permalink
Option to enable/disable install
Browse files Browse the repository at this point in the history
  • Loading branch information
Maratyszcza committed Jun 16, 2024
1 parent 21fcfff commit ae992b5
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ PROJECT(FP16 C)
OPTION(FP16_BUILD_TESTS "Build FP16 unit tests" ON)
OPTION(FP16_BUILD_BENCHMARKS "Build FP16 micro-benchmarks" ON)
OPTION(FP16_BUILD_COMPARATIVE_BENCHMARKS "Build FP16 micro-benchmarks comparing to alternatives" OFF)
OPTION(FP16_INSTALL_LIBRARY "Install the FP16 library headers" ON)

# ---[ CMake options
IF(FP16_BUILD_TESTS OR FP16_BUILD_BENCHMARKS)
Expand Down Expand Up @@ -38,20 +39,21 @@ IF(FP16_BUILD_BENCHMARKS AND NOT DEFINED GOOGLEBENCHMARK_SOURCE_DIR)
SET(GOOGLEBENCHMARK_SOURCE_DIR "${CMAKE_BINARY_DIR}/googlebenchmark-source" CACHE STRING "Google Benchmark source directory")
ENDIF()

INCLUDE(GNUInstallDirs)

# ---[ FP16 library
ADD_LIBRARY(fp16 INTERFACE)
TARGET_INCLUDE_DIRECTORIES(fp16 INTERFACE
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:include>")

INSTALL(FILES include/fp16.h
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
INSTALL(FILES
include/fp16/bitcasts.h
include/fp16/fp16.h
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/fp16")
IF(FP16_INSTALL_LIBRARY)
INCLUDE(GNUInstallDirs)
INSTALL(FILES include/fp16.h
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
INSTALL(FILES
include/fp16/bitcasts.h
include/fp16/fp16.h
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/fp16")
ENDIF()

IF(FP16_BUILD_TESTS)
# ---[ Build google test
Expand Down

0 comments on commit ae992b5

Please sign in to comment.