Skip to content

Commit

Permalink
cmake: -Wl,-undefined,error should not be used on OpenBSD
Browse files Browse the repository at this point in the history
  • Loading branch information
madebr committed Dec 14, 2024
1 parent bf3246a commit e6b5264
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion cmake/PrivateSdlFunctions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ function(check_linker_support_version_script VAR)
endfunction()

function(sdl_target_link_options_no_undefined TARGET)
if(NOT MSVC)
if(NOT MSVC AND NOT CMAKE_SYSTEM_NAME MATCHES ".*OpenBSD.*")
if(CMAKE_C_COMPILER_ID MATCHES "AppleClang")
target_link_options(${TARGET} PRIVATE "-Wl,-undefined,error")
else()
Expand Down Expand Up @@ -339,3 +339,17 @@ function(sdl_get_git_revision_hash VARNAME)
endif()
set("${VARNAME}" "${revision}" PARENT_SCOPE)
endfunction()

function(SDL_install_pdb TARGET DIRECTORY)
get_property(type TARGET ${TARGET} PROPERTY TYPE)
if(type MATCHES "^(SHARED_LIBRARY|EXECUTABLE)$")
install(FILES $<TARGET_PDB_FILE:${TARGET}> DESTINATION "${DIRECTORY}" OPTIONAL)
elseif(type STREQUAL "STATIC_LIBRARY")
# FIXME: Use $<TARGET_COMPILE_PDB_FILE:${TARGET} once it becomes available (https://gitlab.kitware.com/cmake/cmake/-/issues/25244)
if(CMAKE_GENERATOR MATCHES "^Visual Studio.*")
install(CODE "file(INSTALL DESTINATION \"\${CMAKE_INSTALL_PREFIX}/${DIRECTORY}\" TYPE FILE OPTIONAL FILES \"${CMAKE_CURRENT_BINARY_DIR}/\${CMAKE_INSTALL_CONFIG_NAME}/${TARGET}.pdb\")")
else()
install(CODE "file(INSTALL DESTINATION \"\${CMAKE_INSTALL_PREFIX}/${DIRECTORY}\" TYPE FILE OPTIONAL FILES \"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${TARGET}.dir/${TARGET}.pdb\")")
endif()
endif()
endfunction()

0 comments on commit e6b5264

Please sign in to comment.