From 0ce6be2444d1d0d76ba19619aeeff13f16367e27 Mon Sep 17 00:00:00 2001 From: "Jonathan R. Madsen" Date: Fri, 9 Jul 2021 02:13:22 -0500 Subject: [PATCH] Build system fixes (#214) - remove absolute rpath when SKBUILD/SPACK_BUILD - add hatchet/tests/timemory_tests.py to cmake_proces_manifest - tweaks to {dl,rt,pthread}_LIBRARY - warn about PYBIND11_INSTALL - timemory-{c,cxx,fortran} alias libraries in build tree - fixes to building timemory-{mpip,ncclp,mallocp}-shared when static cxx --- CMakeLists.txt | 5 +- VERSION | 2 +- cmake/Modules/BuildSettings.cmake | 56 ++++++++++++++----- cmake/Modules/ConfigCUDA.cmake | 42 ++++++++------ cmake/Modules/Options.cmake | 3 + cmake/Modules/Packages.cmake | 7 ++- external/CMakeLists.txt | 7 +++ setup.py | 36 ++++++------ source/CMakeLists.txt | 18 ++++++ source/tools/timemory-mallocp/CMakeLists.txt | 12 +++- .../timemory-mallocp/timemory-mallocp.cpp | 6 +- source/tools/timemory-mpip/CMakeLists.txt | 12 +++- source/tools/timemory-mpip/timemory-mpip.cpp | 10 ++-- source/tools/timemory-ncclp/CMakeLists.txt | 12 +++- .../tools/timemory-ncclp/timemory-ncclp.cpp | 6 +- source/tools/timemory-ompt/CMakeLists.txt | 13 ++--- 16 files changed, 169 insertions(+), 78 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ca0d5990e..48d1926ee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,7 +96,10 @@ set(CMAKE_INSTALL_CONFIGDIR ${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PROJECT_NAME}) if(UNIX AND NOT APPLE) set(CMAKE_INSTALL_RPATH - "\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}:\$ORIGIN/timemory:\$ORIGIN:${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}:${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/timemory") + "\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}:\$ORIGIN/timemory:\$ORIGIN") + if(NOT SKBUILD AND NOT SPACK_BUILD) + set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH}:${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}:${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/timemory") + endif() endif() # create the full path version and generic path versions diff --git a/VERSION b/VERSION index 580ab568f..163bfcd5a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.2.1.rc14 +3.2.1.rc15 diff --git a/cmake/Modules/BuildSettings.cmake b/cmake/Modules/BuildSettings.cmake index 3b532206d..1b1c634aa 100644 --- a/cmake/Modules/BuildSettings.cmake +++ b/cmake/Modules/BuildSettings.cmake @@ -10,19 +10,54 @@ include_guard(DIRECTORY) include(GNUInstallDirs) include(Compilers) +include(FindPackageHandleStandardArgs) target_compile_definitions(timemory-compile-options INTERFACE $<$:DEBUG>) -if(CMAKE_DL_LIBS) - set(dl_LIBRARY ${CMAKE_DL_LIBS}) - target_link_libraries(timemory-compile-options INTERFACE ${CMAKE_DL_LIBS}) -else() - find_library(dl_LIBRARY NAMES dl) +#----------------------------------------------------------------------------------------# +# dynamic linking and runtime libraries +# +if(CMAKE_DL_LIBS AND NOT "${CMAKE_DL_LIBS}" STREQUAL "dl") + # if cmake provides dl library, use that + set(dl_LIBRARY ${CMAKE_DL_LIBS} CACHE FILEPATH "dynamic linking system library") +endif() + +foreach(_TYPE dl rt dw) + if(NOT ${_TYPE}_LIBRARY) + find_library(${_TYPE}_LIBRARY NAMES ${_TYPE}) + endif() +endforeach() + +find_package_handle_standard_args(dl-library REQUIRED_VARS dl_LIBRARY) +find_package_handle_standard_args(rt-library REQUIRED_VARS rt_LIBRARY) +# find_package_handle_standard_args(dw-library REQUIRED_VARS dw_LIBRARY) + +if(TIMEMORY_BUILD_PORTABLE) if(dl_LIBRARY) - target_link_libraries(timemory-compile-options INTERFACE ${dl_LIBRARY}) + set(dl_LIBRARY dl) + else() + set(dl_LIBRARY) + endif() +elseif(dl_LIBRARY) + add_rpath(${dl_LIBRARY}) +endif() + +if(dl_LIBRARY) + target_link_libraries(timemory-compile-options INTERFACE ${dl_LIBRARY}) +endif() + +if(TIMEMORY_BUILD_PORTABLE) + if(rt_LIBRARY) + set(rt_LIBRARY rt) + else() + set(rt_LIBRARY) endif() +elseif(rt_LIBRARY) + add_rpath(${rt_LIBRARY}) endif() +#----------------------------------------------------------------------------------------# + if(WIN32) set(OS_FLAG "/bigobj") else() @@ -72,15 +107,6 @@ endif() add_interface_library(timemory-compile-debuginfo "Attempts to set best flags for more expressive profiling information in debug or optimized binaries") -# if cmake provides dl library, use that -if(CMAKE_DL_LIBS) - set(dl_LIBRARY "${CMAKE_DL_LIBS}" CACHE STRING "dynamic linking libraries") -endif() - -find_library(rt_LIBRARY NAMES rt) -find_library(dl_LIBRARY NAMES dl) -find_library(dw_LIBRARY NAMES dw) - add_target_flag_if_avail(timemory-compile-debuginfo "-g" "-fno-omit-frame-pointer" diff --git a/cmake/Modules/ConfigCUDA.cmake b/cmake/Modules/ConfigCUDA.cmake index 0c55c0a47..6f998731a 100644 --- a/cmake/Modules/ConfigCUDA.cmake +++ b/cmake/Modules/ConfigCUDA.cmake @@ -157,28 +157,38 @@ if("CUDA" IN_LIST LANGUAGES) ${CUDA_INCLUDE_DIRS} ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}) - find_library(CUDA_dl_LIBRARY - NAMES dl) + if(NOT CUDA_dl_LIBRARY) + if(dl_LIBRARY) + set(CUDA_dl_LIBRARY ${dl_LIBRARY}) + else() + find_library(CUDA_dl_LIBRARY NAMES dl) + endif() + endif() - target_link_libraries(${PROJECT_CUDA_INTERFACE_PREFIX}-cudart INTERFACE - ${CUDA_CUDART_LIBRARY} ${CUDA_rt_LIBRARY}) + if(NOT CUDA_rt_LIBRARY) + if(rt_LIBRARY) + set(CUDA_rt_LIBRARY ${rt_LIBRARY}) + else() + find_library(CUDA_rt_LIBRARY NAMES rt) + endif() + endif() - target_link_libraries(${PROJECT_CUDA_INTERFACE_PREFIX}-cudart-device INTERFACE - ${CUDA_cudadevrt_LIBRARY} ${CUDA_rt_LIBRARY}) + if(NOT CUDA_dl_LIBRARY) + set(CUDA_dl_LIBRARY) + endif() - target_link_libraries(${PROJECT_CUDA_INTERFACE_PREFIX}-cudart-static INTERFACE - ${CUDA_cudart_static_LIBRARY} ${CUDA_rt_LIBRARY}) + if(NOT CUDA_rt_LIBRARY) + set(CUDA_rt_LIBRARY) + endif() - if(CUDA_dl_LIBRARY) - target_link_libraries(${PROJECT_CUDA_INTERFACE_PREFIX}-cudart INTERFACE - ${CUDA_dl_LIBRARY}) + target_link_libraries(${PROJECT_CUDA_INTERFACE_PREFIX}-cudart INTERFACE + ${CUDA_CUDART_LIBRARY} ${CUDA_rt_LIBRARY} ${CUDA_dl_LIBRARY}) - target_link_libraries(${PROJECT_CUDA_INTERFACE_PREFIX}-cudart-device INTERFACE - ${CUDA_dl_LIBRARY}) + target_link_libraries(${PROJECT_CUDA_INTERFACE_PREFIX}-cudart-device INTERFACE + ${CUDA_cudadevrt_LIBRARY} ${CUDA_rt_LIBRARY} ${CUDA_dl_LIBRARY}) - target_link_libraries(${PROJECT_CUDA_INTERFACE_PREFIX}-cudart-static INTERFACE - ${CUDA_dl_LIBRARY}) - endif() + target_link_libraries(${PROJECT_CUDA_INTERFACE_PREFIX}-cudart-static INTERFACE + ${CUDA_cudart_static_LIBRARY} ${CUDA_rt_LIBRARY} ${CUDA_dl_LIBRARY}) else() message(FATAL_ERROR diff --git a/cmake/Modules/Options.cmake b/cmake/Modules/Options.cmake index 7151786b9..89b6f37e1 100644 --- a/cmake/Modules/Options.cmake +++ b/cmake/Modules/Options.cmake @@ -582,6 +582,9 @@ if(TIMEMORY_BUILD_DOCS) endif() set(PYBIND11_INSTALL OFF CACHE BOOL "Install Pybind11") +if(PYBIND11_INSTALL AND (SKBUILD OR SPACK_BUILD)) + timemory_message(WARNING "Pybind11 will be installed. This may overwrite an existing pip/conda/spack PyBind11 installation...") +endif() # clang-tidy macro(_TIMEMORY_ACTIVATE_CLANG_TIDY) diff --git a/cmake/Modules/Packages.cmake b/cmake/Modules/Packages.cmake index 20da4cec9..c2bde0e40 100644 --- a/cmake/Modules/Packages.cmake +++ b/cmake/Modules/Packages.cmake @@ -526,15 +526,16 @@ if(NOT WIN32) set(THREADS_PREFER_PTHREAD_FLAG OFF) endif() -find_library(PTHREADS_LIBRARY pthread) +find_library(pthread_LIBRARY NAMES pthread pthreads) +find_package_handle_standard_args(pthread-library REQUIRED_VARS pthread_LIBRARY) find_package(Threads ${TIMEMORY_FIND_QUIETLY} ${TIMEMORY_FIND_REQUIREMENT}) if(Threads_FOUND) target_link_libraries(timemory-threading INTERFACE ${CMAKE_THREAD_LIBS_INIT}) endif() -if(PTHREADS_LIBRARY AND NOT WIN32) - target_link_libraries(timemory-threading INTERFACE ${PTHREADS_LIBRARY}) +if(NOT TIMEMORY_BUILD_PORTABLE AND pthread_LIBRARY AND NOT WIN32) + target_link_libraries(timemory-threading INTERFACE ${pthread_LIBRARY}) endif() diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index fff7f00a5..17d028ded 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -38,12 +38,19 @@ if(TIMEMORY_USE_PYTHON AND TIMEMORY_BUILD_PYTHON_HATCHET) add_dependencies(libpytimemory hatchet) if(CMAKE_INSTALL_PYTHONDIR) set(HATCHET_PYDIR "${CMAKE_CURRENT_LIST_DIR}/hatchet/hatchet") + file(GLOB_RECURSE hatchet_files "${HATCHET_PYDIR}/*.py" "${HATCHET_PYDIR}/*.js") + file(GLOB_RECURSE hatchet_test_files "${HATCHET_PYDIR}/tests/*") + if("${HATCHET_PYDIR}/tests/timemory_test.py" IN_LIST hatchet_test_files) + list(REMOVE_ITEM hatchet_test_files + "${HATCHET_PYDIR}/tests/timemory_test.py") + endif() + set(HATCHET_CYTHONDIR "${HATCHET_PYDIR}/cython_modules/libs") diff --git a/setup.py b/setup.py index 65f3db1a7..da604b169 100644 --- a/setup.py +++ b/setup.py @@ -385,30 +385,34 @@ def parse_requirements(fname="requirements.txt"): # --------------------------------------------------------------------------- # # def exclude_install_hook(cmake_manifest): - cmake_manifest = list( - filter(lambda name: "pytest.ini" not in name, cmake_manifest) + def _filter_manifest(_manifest, *args): + for itr in args: + _manifest = list( + filter( + lambda name: itr not in name, + cmake_manifest, + ) + ) + return _manifest + + cmake_manifest = _filter_manifest( + cmake_manifest, + "pytest.ini", + os.path.join("hatchet", "tests", "timemory_test.py"), ) if not get_bool_option(args, "develop"): cmake_manifest = list( filter(lambda name: not (name.endswith(".a")), cmake_manifest) ) if not get_bool_option(args, "install-config"): - cmake_manifest = list( - filter( - lambda name: (os.path.join("share", "cmake") not in name), - cmake_manifest, - ) - ) - cmake_manifest = list( - filter( - lambda name: (os.path.join("lib", "cmake") not in name), - cmake_manifest, - ) + cmake_manifest = _filter_manifest( + cmake_manifest, + os.path.join("share", "cmake"), + os.path.join("lib", "cmake"), ) if not get_bool_option(args, "install-headers"): - cmake_manifest = list( - filter(lambda name: "include" not in name, cmake_manifest) - ) + cmake_manifest = _filter_manifest(cmake_manifest, "include") + return cmake_manifest diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 0e7eac3b6..65f3f3e71 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -363,6 +363,20 @@ if(TIMEMORY_BUILD_FORTRAN) endif() endif() +#----------------------------------------------------------------------------------------# +# +# Language aliases libraries +# +#----------------------------------------------------------------------------------------# + +foreach(_LANG c cxx fortran) + if(TARGET timemory-${_LANG}-shared) + add_library(timemory::timemory-${_LANG} ALIAS timemory-${_LANG}-shared) + elseif(TARGET timemory-${_LANG}-static) + add_library(timemory::timemory-${_LANG} ALIAS timemory-${_LANG}-static) + endif() +endforeach() + #----------------------------------------------------------------------------------------# # # TOOL executables and libraries @@ -392,6 +406,7 @@ if(TARGET timemory-mpip-shared) list(APPEND TIMEMORY_TOOL_LIBRARIES timemory-mpip-shared) else() inform_empty_interface(timemory-mpip-library "MPIP standalone instrumentation library") + set(TIMEMORY_BUILD_MPIP_LIBRARY OFF PARENT_SCOPE) endif() if(_OMPT_LIB) @@ -400,6 +415,7 @@ if(_OMPT_LIB) target_link_libraries(timemory-ompt-library INTERFACE timemory-ompt ${_OMPT_LIB}) else() inform_empty_interface(timemory-ompt-library "OpenMP stand-alone instrumentation library") + set(TIMEMORY_BUILD_OMPT_LIBRARY OFF PARENT_SCOPE) endif() if(TARGET timemory-ncclp-shared) @@ -409,6 +425,7 @@ if(TARGET timemory-ncclp-shared) list(APPEND TIMEMORY_TOOL_LIBRARIES timemory-ncclp-shared) else() inform_empty_interface(timemory-ncclp-library "NCCLP standalone instrumentation library") + set(TIMEMORY_BUILD_NCCLP_LIBRARY OFF PARENT_SCOPE) endif() if(TARGET timemory-mallocp-shared) @@ -418,6 +435,7 @@ if(TARGET timemory-mallocp-shared) list(APPEND TIMEMORY_TOOL_LIBRARIES timemory-mallocp-shared) else() inform_empty_interface(timemory-mallocp-library "MALLOCP standalone instrumentation library") + set(TIMEMORY_BUILD_MALLOCP_LIBRARY OFF PARENT_SCOPE) endif() if(TARGET timemory-compiler-instrument-base) diff --git a/source/tools/timemory-mallocp/CMakeLists.txt b/source/tools/timemory-mallocp/CMakeLists.txt index f03e77bbc..9c5d02212 100644 --- a/source/tools/timemory-mallocp/CMakeLists.txt +++ b/source/tools/timemory-mallocp/CMakeLists.txt @@ -1,6 +1,7 @@ cmake_minimum_required(VERSION 3.15 FATAL_ERROR) -if(NOT TIMEMORY_USE_GOTCHA OR NOT TARGET timemory::timemory-cxx-shared) +if(NOT TIMEMORY_USE_GOTCHA OR + (BUILD_STATIC_LIBS AND NOT BUILD_SHARED_LIBS AND NOT CMAKE_POSITION_INDEPENDENT_CODE)) return() endif() @@ -8,6 +9,13 @@ if(NOT TIMEMORY_BUILD_MALLOCP_LIBRARY OR TIMEMORY_SKIP_BUILD OR TIMEMORY_BUILD_E set(_EXCLUDE EXCLUDE_FROM_ALL) endif() +if(NOT TARGET timemory::timemory-cxx) + if(TIMEMORY_BUILD_MALLOCP_LIBRARY) + message(WARNING "timemory-mallocp-library cannot be built due to missing timemory::timemory-cxx target") + endif() + return() +endif() + project(timemory-mallocp-tool) add_library(timemory-mallocp-shared SHARED ${_EXCLUDE} ${PROJECT_SOURCE_DIR}/timemory-mallocp.cpp) @@ -16,7 +24,7 @@ add_library(timemory::timemory-mallocp-shared ALIAS timemory-mallocp-shared) # public link targets target_link_libraries(timemory-mallocp-shared PUBLIC timemory::timemory-headers - timemory::timemory-cxx-shared + timemory::timemory-cxx timemory::timemory-gotcha) # private link targets diff --git a/source/tools/timemory-mallocp/timemory-mallocp.cpp b/source/tools/timemory-mallocp/timemory-mallocp.cpp index b1d6ac1db..037e489e3 100644 --- a/source/tools/timemory-mallocp/timemory-mallocp.cpp +++ b/source/tools/timemory-mallocp/timemory-mallocp.cpp @@ -32,9 +32,9 @@ using namespace tim::component; -using malloc_toolset_t = tim::component_tuple; -uint64_t global_cnt = 0; -uint64_t global_id = std::numeric_limits::max(); +using malloc_toolset_t = tim::component_tuple; +static uint64_t global_cnt = 0; +static uint64_t global_id = std::numeric_limits::max(); // //--------------------------------------------------------------------------------------// // diff --git a/source/tools/timemory-mpip/CMakeLists.txt b/source/tools/timemory-mpip/CMakeLists.txt index 040c0b609..8646b1cfb 100644 --- a/source/tools/timemory-mpip/CMakeLists.txt +++ b/source/tools/timemory-mpip/CMakeLists.txt @@ -1,6 +1,7 @@ cmake_minimum_required(VERSION 3.15 FATAL_ERROR) -if(NOT TIMEMORY_USE_GOTCHA OR NOT TIMEMORY_USE_MPI OR NOT TARGET timemory::timemory-cxx-shared) +if(NOT TIMEMORY_USE_GOTCHA OR NOT TIMEMORY_USE_MPI OR + (BUILD_STATIC_LIBS AND NOT BUILD_SHARED_LIBS AND NOT CMAKE_POSITION_INDEPENDENT_CODE)) return() endif() @@ -8,6 +9,13 @@ if(NOT TIMEMORY_BUILD_MPIP_LIBRARY OR TIMEMORY_SKIP_BUILD OR TIMEMORY_BUILD_EXCL set(_EXCLUDE EXCLUDE_FROM_ALL) endif() +if(NOT TARGET timemory::timemory-cxx) + if(TIMEMORY_BUILD_MPIP_LIBRARY) + message(WARNING "timemory-mpip-library cannot be built due to missing timemory::timemory-cxx target") + endif() + return() +endif() + project(timemory-mpip-tool) add_library(timemory-mpip-shared SHARED ${_EXCLUDE} ${PROJECT_SOURCE_DIR}/timemory-mpip.cpp) @@ -16,7 +24,7 @@ add_library(timemory::timemory-mpip-shared ALIAS timemory-mpip-shared) # public link targets target_link_libraries(timemory-mpip-shared PUBLIC timemory::timemory-headers - timemory::timemory-cxx-shared + timemory::timemory-cxx timemory::timemory-mpi timemory::timemory-gotcha) diff --git a/source/tools/timemory-mpip/timemory-mpip.cpp b/source/tools/timemory-mpip/timemory-mpip.cpp index c50dfe519..e60ae3794 100644 --- a/source/tools/timemory-mpip/timemory-mpip.cpp +++ b/source/tools/timemory-mpip/timemory-mpip.cpp @@ -51,11 +51,11 @@ TIMEMORY_DEFINE_CONCRETE_TRAIT(is_memory_category, mpi_data_tracker_t, true_type // //--------------------------------------------------------------------------------------// // -using api_t = TIMEMORY_API; -using mpi_toolset_t = tim::component_tuple; -using mpip_handle_t = mpip_handle; -uint64_t global_id = 0; -void* libmpi_handle = nullptr; +using api_t = TIMEMORY_API; +using mpi_toolset_t = tim::component_tuple; +using mpip_handle_t = mpip_handle; +static uint64_t global_id = 0; +static void* libmpi_handle = nullptr; // //--------------------------------------------------------------------------------------// // diff --git a/source/tools/timemory-ncclp/CMakeLists.txt b/source/tools/timemory-ncclp/CMakeLists.txt index f8e2b241a..ac786ee05 100644 --- a/source/tools/timemory-ncclp/CMakeLists.txt +++ b/source/tools/timemory-ncclp/CMakeLists.txt @@ -1,6 +1,7 @@ cmake_minimum_required(VERSION 3.15 FATAL_ERROR) -if(NOT TIMEMORY_USE_GOTCHA OR NOT TIMEMORY_USE_NCCL OR NOT TARGET timemory::timemory-cxx-shared) +if(NOT TIMEMORY_USE_GOTCHA OR NOT TIMEMORY_USE_NCCL OR + (BUILD_STATIC_LIBS AND NOT BUILD_SHARED_LIBS AND NOT CMAKE_POSITION_INDEPENDENT_CODE)) return() endif() @@ -8,6 +9,13 @@ if(NOT TIMEMORY_BUILD_NCCLP_LIBRARY OR TIMEMORY_SKIP_BUILD OR TIMEMORY_BUILD_EXC set(_EXCLUDE EXCLUDE_FROM_ALL) endif() +if(NOT TARGET timemory::timemory-cxx) + if(TIMEMORY_BUILD_NCCLP_LIBRARY) + message(WARNING "timemory-ncclp-library cannot be built due to missing timemory::timemory-cxx target") + endif() + return() +endif() + project(timemory-ncclp-tool) add_library(timemory-ncclp-shared SHARED ${_EXCLUDE} ${PROJECT_SOURCE_DIR}/timemory-ncclp.cpp) @@ -16,7 +24,7 @@ add_library(timemory::timemory-ncclp-shared ALIAS timemory-ncclp-shared) # public link targets target_link_libraries(timemory-ncclp-shared PUBLIC timemory::timemory-headers - timemory::timemory-cxx-shared + timemory::timemory-cxx timemory::timemory-nccl timemory::timemory-gotcha) diff --git a/source/tools/timemory-ncclp/timemory-ncclp.cpp b/source/tools/timemory-ncclp/timemory-ncclp.cpp index 0399177d7..ed91610c2 100644 --- a/source/tools/timemory-ncclp/timemory-ncclp.cpp +++ b/source/tools/timemory-ncclp/timemory-ncclp.cpp @@ -57,9 +57,9 @@ TIMEMORY_DEFINE_CONCRETE_TRAIT(is_memory_category, nccl_data_tracker_t, true_typ using api_t = ncclp_tag; using nccl_toolset_t = tim::component_tuple; -using ncclp_handle_t = ncclp_handle; -uint64_t global_id = 0; -void* libnccl_handle = nullptr; +using ncclp_handle_t = ncclp_handle; +static uint64_t global_id = 0; +static void* libnccl_handle = nullptr; // //--------------------------------------------------------------------------------------// // diff --git a/source/tools/timemory-ompt/CMakeLists.txt b/source/tools/timemory-ompt/CMakeLists.txt index 74cd0e400..a7eee1399 100644 --- a/source/tools/timemory-ompt/CMakeLists.txt +++ b/source/tools/timemory-ompt/CMakeLists.txt @@ -11,16 +11,11 @@ endif() project(timemory-ompt-tool) -set(LIB_TYPES) -if(BUILD_SHARED_LIBS AND NOT TIMEMORY_SKIP_BUILD) - list(APPEND LIB_TYPES SHARED) -endif() - -if(BUILD_STATIC_LIBS AND NOT TIMEMORY_SKIP_BUILD) - list(APPEND LIB_TYPES STATIC) -endif() +foreach(_TYPE SHARED STATIC) -foreach(_TYPE ${LIB_TYPES}) + if(NOT BUILD_${_TYPE}_LIBS) + continue() + endif() string(TOLOWER "${_TYPE}" _LC_TYPE) if(NOT TARGET timemory-cxx-${_LC_TYPE})