aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt4
-rw-r--r--utils/CMakeLists.txt30
2 files changed, 17 insertions, 17 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0bc4006..62bd1e3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.1)
+cmake_minimum_required(VERSION 3.5) # for Boost::* imported targets
project(pdb_repo CXX)
@@ -11,7 +11,7 @@ file(GLOB_RECURSE pdb_repo_src "src/*.cpp")
add_library(pdb_repo ${pdb_repo_include} ${pdb_repo_src})
target_compile_definitions(pdb_repo PUBLIC _NO_CVCONST_H)
target_include_directories(pdb_repo PUBLIC include/)
-target_include_directories(pdb_repo SYSTEM PUBLIC ${Boost_INCLUDE_DIRS})
+target_link_libraries(pdb_repo PUBLIC Boost::boost)
target_link_libraries(pdb_repo PRIVATE DbgHelp)
add_subdirectory(utils)
diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt
index 6d1d6b9..ee5c5ba 100644
--- a/utils/CMakeLists.txt
+++ b/utils/CMakeLists.txt
@@ -1,15 +1,15 @@
-find_package(Boost REQUIRED COMPONENTS filesystem program_options system)
-
-add_executable(enum_symbols enum_symbols.cpp command_line.hpp pdb_descr.hpp)
-target_include_directories(enum_symbols SYSTEM PRIVATE ${Boost_INCLUDE_DIRS})
-target_link_libraries(enum_symbols PRIVATE pdb_repo ${Boost_LIBRARIES})
-
-add_executable(name2addr name2addr.cpp)
-target_include_directories(name2addr SYSTEM PRIVATE ${Boost_INCLUDE_DIRS})
-target_link_libraries(name2addr PRIVATE pdb_repo ${Boost_LIBRARIES})
-
-add_executable(addr2name addr2name.cpp command_line.hpp pdb_descr.hpp)
-target_include_directories(addr2name SYSTEM PRIVATE ${Boost_INCLUDE_DIRS})
-target_link_libraries(addr2name PRIVATE pdb_repo ${Boost_LIBRARIES})
-
-install(TARGETS enum_symbols name2addr addr2name RUNTIME DESTINATION bin)
+find_package(Boost REQUIRED COMPONENTS filesystem program_options)
+
+function(add_util name src)
+ add_executable("${name}" ${src})
+ target_link_libraries("${name}" PRIVATE pdb_repo)
+ target_link_libraries("${name}" PRIVATE Boost::filesystem Boost::program_options)
+ install(TARGETS "${name}" RUNTIME DESTINATION bin)
+ if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
+ install(FILES "$<TARGET_PDB_FILE:${name}>" DESTINATION bin OPTIONAL)
+ endif()
+endfunction()
+
+add_util(enum_symbols enum_symbols.cpp command_line.hpp pdb_descr.hpp)
+add_util(name2addr name2addr.cpp)
+add_util(addr2name addr2name.cpp command_line.hpp pdb_descr.hpp)