diff --git a/CMakeLists.txt b/CMakeLists.txt index 411e51fa874..91a6d09308f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -450,7 +450,8 @@ endif() # Third-party libraries (tpls) # ============================================================================== -set(FMT_INSTALL ON) +# Disable fmt's install rules so that no fmt headers/targets get exported +set(FMT_INSTALL OFF CACHE BOOL "Disable installing fmt; keep it private to CUDA-Q." FORCE) cmake_policy(PUSH) # CMP0146: The FindCUDA module is removed. # CMake 3.27 and above no longer provide the modules. @@ -458,7 +459,7 @@ cmake_policy(PUSH) if(POLICY CMP0146) cmake_policy(SET CMP0146 OLD) endif() -add_subdirectory(tpls/fmt) +add_subdirectory(tpls/fmt EXCLUDE_FROM_ALL) cmake_policy(POP) include_directories(SYSTEM tpls/json/include) diff --git a/runtime/cudaq/platform/mqpu/remote/CMakeLists.txt b/runtime/cudaq/platform/mqpu/remote/CMakeLists.txt index bc3fbe964f3..82bee689e31 100644 --- a/runtime/cudaq/platform/mqpu/remote/CMakeLists.txt +++ b/runtime/cudaq/platform/mqpu/remote/CMakeLists.txt @@ -12,8 +12,8 @@ target_link_libraries(cudaq-remote-simulator-qpu PUBLIC cudaq-common cudaq-mlir-runtime rest-remote-platform-client - fmt::fmt-header-only cudaq-platform-mqpu + PRIVATE fmt::fmt-header-only ) install(TARGETS cudaq-remote-simulator-qpu DESTINATION lib) diff --git a/runtime/nvqir/CMakeLists.txt b/runtime/nvqir/CMakeLists.txt index 251719e9ed0..57f1921366b 100644 --- a/runtime/nvqir/CMakeLists.txt +++ b/runtime/nvqir/CMakeLists.txt @@ -31,7 +31,8 @@ set_property(GLOBAL APPEND PROPERTY CUDAQ_RUNTIME_LIBS ${LIBRARY_NAME}) # and by keeping it private, others can specify the # backend library later on target_link_libraries(${LIBRARY_NAME} - PUBLIC cudaq-common cudaq-operator dl fmt::fmt-header-only) + PUBLIC cudaq-common cudaq-operator dl + PRIVATE fmt::fmt-header-only) install(TARGETS ${LIBRARY_NAME} EXPORT nvqir-targets diff --git a/unittests/CMakeLists.txt b/unittests/CMakeLists.txt index 8dfc50c6020..55157036559 100644 --- a/unittests/CMakeLists.txt +++ b/unittests/CMakeLists.txt @@ -70,10 +70,10 @@ macro (create_tests_with_backend NVQIR_BACKEND EXTRA_BACKEND_TESTER) nvqir-${NVQIR_BACKEND} nvqir cudaq - fmt::fmt-header-only cudaq-platform-default cudaq-builder - gtest_main) + gtest_main + PRIVATE fmt::fmt-header-only) set(TEST_LABELS "") if (${NVQIR_BACKEND} STREQUAL "qpp") target_compile_definitions(${TEST_EXE_NAME} PRIVATE -DCUDAQ_SIMULATION_SCALAR_FP64)