Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})


# GNUInstallDirs to provide sensible default install directory names
cmake_path(SET ORG_INSTALL_PATH NORMALIZE "${CMAKE_INSTALL_PREFIX}")
cmake_path(APPEND CMAKE_INSTALL_PREFIX "quest")
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)

Expand Down Expand Up @@ -74,10 +72,11 @@ endif()


# Library type
# Shared library by default
option(BUILD_SHARED_LIBS "Build shared library. Turned ON by default." ON)
message(STATUS "Shared library is turned ${BUILD_SHARED_LIBS}. Set BUILD_SHARED_LIBS to modify.")

# Shared library by default when we are the top level cmake project
if(PROJECT_IS_TOP_LEVEL)
option(BUILD_SHARED_LIBS "Build shared library. Turned ON by default." ON)
message(STATUS "Shared library is turned ${BUILD_SHARED_LIBS}. Set BUILD_SHARED_LIBS to modify.")
endif ()

# Library naming
set(LIB_NAME QuEST
Expand Down Expand Up @@ -185,6 +184,7 @@ option(
)
message(STATUS "Disabling of deprecated API warnings is turned ${DISABLE_DEPRECATION_WARNINGS}. Set DISABLE_DEPRECATION_WARNINGS to modify.")

option(INSTALL_BINARIES "Whether to include example and user binaries in the install." OFF)


# ============================
Expand Down Expand Up @@ -565,10 +565,12 @@ add_executable(min_example
)
target_link_libraries(min_example PRIVATE QuEST::QuEST)

install(TARGETS min_example
RUNTIME
DESTINATION ${CMAKE_INSTALL_BINDIR}
)
if (INSTALL_BINARIES)
install(TARGETS min_example
RUNTIME
DESTINATION ${CMAKE_INSTALL_BINDIR}
)
endif ()


# all examples optionally built
Expand All @@ -577,7 +579,7 @@ if (BUILD_EXAMPLES)
endif()


## RATH
## RPATH
set(BUILD_RPATH_USE_ORIGIN ON)
if(APPLE)
set(_RPATH_ORIGIN "@loader_path")
Expand Down Expand Up @@ -732,3 +734,7 @@ install(
NAMESPACE QuEST::
DESTINATION "${QuEST_INSTALL_CONFIGDIR}"
)

if(PROJECT_IS_TOP_LEVEL)
include(CPack)
endif ()
12 changes: 7 additions & 5 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ function(add_example direc in_fn)
add_executable(${target} ${in_fn})
target_link_libraries(${target} PUBLIC QuEST)

install(
TARGETS ${target}
RUNTIME
DESTINATION ${out_dir}
)
if (INSTALL_BINARIES)
install(
TARGETS ${target}
RUNTIME
DESTINATION ${out_dir}
)
endif ()

set_target_properties(${target}
PROPERTIES
Expand Down