From ca9a3a42a4e383c4681e10c5a75adef17a59fcb0 Mon Sep 17 00:00:00 2001 From: Carleton DeTar Date: Wed, 17 Jun 2026 21:57:44 -0600 Subject: [PATCH 1/2] Add cmake option to create shared library. --- CMakeLists.txt | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4923f9e..5df3fe5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,7 @@ set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) # Boiler plate -- CTest include(CTest) +mark_as_advanced(BUILD_TESTING) #Options # --enable-extra-debugging @@ -33,7 +34,7 @@ option(QMP_BGQ "Enable BlueGene/Q Personality to set native machine geometry" OF option(QMP_BGSPI "Enable BlueGene SPI" OFF) # --enable-testing -option(QMP_TESTING "Enable buidling of the examples" ON) +option(QMP_BUILD_TESTS "Enable buidling of the examples" ON) # Enable Address address and undefined behaviour sanitizers option(QMP_ENABLE_SANITIZERS "Enable Address and Undefined Behaviour Sanitizers" OFF) @@ -98,13 +99,26 @@ if( QMP_ENABLE_SANITIZERS ) message(STATUS "QMP: Setting Sanitizer options: ${QMP_SANITIZER_OPTS}") endif() +if(QMP_BUILD_TESTS) + set(BUILD_TESTING ON) +endif() + +if(QMP_BUILD_SHARED_LIBS) + set(BUILD_SHARED_LIBS ON) +endif() + # Configuration file configure_file(include/qmp_config.h.cmake.in include/qmp_config.h) configure_file(bin/qmp-config.cmake.in bin/qmp-config @ONLY) -add_subdirectory(lib) -if( QMP_TESTING ) +option(QMP_BUILD_SHARED_LIBS "Build shared library (in addition to or instead of static)" OFF) +if(QMP_BUILD_SHARED_LIBS) + set(BUILD_SHARED_LIBS ON CACHE BOOL "" FORCE) +endif() + +add_subdirectory(lib) +if( QMP_BUILD_TESTS ) add_subdirectory(examples) endif() From f38856c2cdfa7ad9252d7455c66c06df0b578b7b Mon Sep 17 00:00:00 2001 From: Carleton DeTar Date: Wed, 17 Jun 2026 21:58:36 -0600 Subject: [PATCH 2/2] Fix permission on lib --- lib/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index bdcd23c..e6fd25e 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -63,6 +63,7 @@ endif() install(TARGETS qmp EXPORT QMPTargets LIBRARY DESTINATION lib + PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ ARCHIVE DESTINATION lib RUNTIME DESTINATION bin INCLUDES DESTINATION include