Skip to content

Commit

Permalink
Set better default CMake options (#24)
Browse files Browse the repository at this point in the history
* Default to building shared libs
* Set other CMake options
  • Loading branch information
sethrj authored Feb 17, 2025
1 parent dfae7e4 commit 5cd5b24
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,23 @@ option(G4VG_BUILD_TESTS "Build G4VG unit tests" OFF)
option(G4VG_DEBUG "Add runtime assertions" ON)
g4vg_set_default(BUILD_TESTING ${G4VG_BUILD_TESTS})

g4vg_set_default(BUILD_SHARED_LIBS ON)
g4vg_set_default(CMAKE_CXX_EXTENSIONS OFF)

if(BUILD_SHARED_LIBS)
# Inform installed binaries of internal library rpaths
g4vg_set_default(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_FULL_LIBDIR}")
# Do not relink libs/binaries when dependent shared libs change
g4vg_set_default(CMAKE_LINK_DEPENDS_NO_SHARED ON)
endif()

# When developing add checking for proper usage of `install(`
if(G4VG_DEBUG)
g4vg_set_default(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION ON)
endif()
# Avoid printing details about already installed files
g4vg_set_default(CMAKE_INSTALL_MESSAGE LAZY)

#----------------------------------------------------------------------------#
# Output locations for G4VG products will mirror the installation layout
set(G4VG_CMAKE_CONFIG_DIRECTORY
Expand Down

0 comments on commit 5cd5b24

Please sign in to comment.