Skip to content

Commit c8ad252

Browse files
AngryLokiafzpatel
andauthored
[rocprofiler-register] Fix compilation with system fmt/glog (#1243)
rocprofiler-register provides options to build with system glog and fmt: `-DROCPROFILER_REGISTER_BUILD_GLOG=OFF -DROCPROFILER_REGISTER_BUILD_FMT=OFF`. However these options don't work, because attempt to call ```cmake find_package(glog REQUIRED) ... find_package(fmt REQUIRED) ``` in the **nested** `external/CMakeLists.txt` does not expose glog and fmt to the **parent** `CMakeLists.txt`. To make projects visible, the easiest way is to add `GLOBAL`: ```cmake find_package(glog REQUIRED GLOBAL) ... find_package(fmt REQUIRED GLOBAL) ``` GLOBAL modifier requires CMake >= 3.24, which was not required in ROCm/rocm-systems, but ROCm/rocm-libraries already requires 3.25, so this change should be safe. Closes #1242. Co-authored-by: Afzal Patel <122491982+afzpatel@users.noreply.github.com>
1 parent 7818815 commit c8ad252

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

projects/rocprofiler-register/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.22.0 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.24 FATAL_ERROR)
22

33
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR AND CMAKE_CURRENT_SOURCE_DIR STREQUAL
44
CMAKE_SOURCE_DIR)

projects/rocprofiler-register/external/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ if(ROCPROFILER_REGISTER_BUILD_GLOG)
1818
set(WITH_UNWIND "none")
1919
add_subdirectory(glog EXCLUDE_FROM_ALL)
2020
else()
21-
find_package(glog REQUIRED)
21+
find_package(glog REQUIRED GLOBAL)
2222
endif()
2323

2424
if(ROCPROFILER_REGISTER_BUILD_FMT)
@@ -33,5 +33,5 @@ if(ROCPROFILER_REGISTER_BUILD_FMT)
3333
set(FMT_TEST OFF)
3434
add_subdirectory(fmt EXCLUDE_FROM_ALL)
3535
else()
36-
find_package(fmt REQUIRED)
36+
find_package(fmt REQUIRED GLOBAL)
3737
endif()

0 commit comments

Comments
 (0)