Skip to content

Commit

Permalink
[CMake] Improve lib/exceptionhandler/CMakeLists.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
past-due committed Jun 9, 2019
1 parent a554438 commit 1bb0d69
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions lib/exceptionhandler/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,22 @@ project (exception-handler CXX)
file(GLOB HEADERS "*.h")
set(SRC "dumpinfo.cpp" "exceptionhandler.cpp")

add_library(exception-handler STATIC ${HEADERS} ${SRC})
set_property(TARGET exception-handler PROPERTY FOLDER "lib")
if(WZ_TARGET_ADDITIONAL_PROPERTIES)
SET_TARGET_PROPERTIES(exception-handler PROPERTIES ${WZ_TARGET_ADDITIONAL_PROPERTIES})
endif()

if(CMAKE_SYSTEM_NAME MATCHES "Windows")
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" AND ${CMAKE_CROSSCOMPILING})
# Cross-compiling for Windows with MINGW
list(APPEND SRC "exchndl_mingw.cpp")
target_sources(exception-handler PRIVATE "exchndl_mingw.cpp")
target_link_libraries(exception-handler PRIVATE bfd iberty)
else()
# Compiling with MSVC (etc) on Windows
list(APPEND SRC "3rdparty/StackWalker.cpp")
list(APPEND SRC "exchndl_win.cpp")
target_sources(exception-handler PRIVATE "3rdparty/StackWalker.cpp" "exchndl_win.cpp")
target_link_libraries(exception-handler PRIVATE dbghelp version shlwapi)
endif()
endif()

add_library(exception-handler STATIC ${HEADERS} ${SRC})
set_property(TARGET exception-handler PROPERTY FOLDER "lib")
if(WZ_TARGET_ADDITIONAL_PROPERTIES)
SET_TARGET_PROPERTIES(exception-handler PROPERTIES ${WZ_TARGET_ADDITIONAL_PROPERTIES})
endif()
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" AND ${CMAKE_CROSSCOMPILING})
target_link_libraries(exception-handler PRIVATE bfd iberty)
elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC")
target_link_libraries(exception-handler PRIVATE dbghelp version shlwapi)
endif()
target_link_libraries(exception-handler PRIVATE framework)

0 comments on commit 1bb0d69

Please sign in to comment.