Skip to content

Commit

Permalink
cmake: replace set_property() with target_{link,compile}_options()
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterMatula committed Jun 11, 2020
1 parent 5068d33 commit 7fa4753
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 20 deletions.
4 changes: 1 addition & 3 deletions src/llvmir2hll/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -321,9 +321,7 @@ target_link_libraries(llvmir2hll
# fatal error C1128: number of sections exceeded object file format
# limit: compile with /bigobj
if(MSVC)
set_property(TARGET llvmir2hll
APPEND_STRING PROPERTY COMPILE_FLAGS " /bigobj"
)
target_compile_options(llvmir2hll PUBLIC "/bigobj")
endif()

set_target_properties(llvmir2hll
Expand Down
12 changes: 3 additions & 9 deletions src/retdec-decompiler/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,14 @@ if(MSVC)
retdec::bin2llvmir -WHOLEARCHIVE:$<TARGET_FILE_NAME:retdec::bin2llvmir>
retdec::llvmir2hll -WHOLEARCHIVE:$<TARGET_FILE_NAME:retdec::llvmir2hll>
)
set_property(TARGET retdec-decompiler
APPEND_STRING PROPERTY LINK_FLAGS " /FORCE:MULTIPLE"
)
target_link_options(retdec-decompiler PUBLIC "/FORCE:MULTIPLE")
# Increase the stack size of the created binaries on MS Windows because the
# default value is too small. The default Linux value is 8388608 (8 MB).
set_property(TARGET retdec-decompiler
APPEND_STRING PROPERTY LINK_FLAGS " /STACK:16777216"
)
target_link_options(retdec-decompiler PUBLIC "/STACK:16777216")
# Allow the 32b version of bin2llvmir on Windows handle addresses larger
# than 2 GB (up to 4 GB).
if(CMAKE_SIZEOF_VOID_P MATCHES "4")
set_property(TARGET retdec
APPEND_STRING PROPERTY LINK_FLAGS " /LARGEADDRESSAWARE"
)
target_link_options(retdec-decompiler PUBLIC "/LARGEADDRESSAWARE")
endif()
elseif(APPLE)
target_link_libraries(retdec-decompiler
Expand Down
12 changes: 4 additions & 8 deletions src/retdectool/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,17 @@ target_link_libraries(retdectool retdec::retdec)
if(MSVC)
# -WHOLEARCHIVE needs path to the target, but when we use the target like
# that, its properties (associated includes, etc.) are not propagated.
# Therefore, we state 'bin2llvmir' twice in target_link_libraries(),
# Therefore, we state 'retdectool' twice in target_link_libraries(),
# first as a target to get its properties, second as path to library to
# link it as a whole.
target_link_libraries(retdectool
retdec::bin2llvmir -WHOLEARCHIVE:$<TARGET_FILE_NAME:retdec::bin2llvmir>
)
set_property(TARGET retdectool
APPEND_STRING PROPERTY LINK_FLAGS " /FORCE:MULTIPLE"
)
# Allow the 32b version of bin2llvmir on Windows handle addresses larger
target_link_options(retdectool PUBLIC "/FORCE:MULTIPLE")
# Allow the 32b version of retdectool on Windows handle addresses larger
# than 2 GB (up to 4 GB).
if(CMAKE_SIZEOF_VOID_P MATCHES "4")
set_property(TARGET retdec
APPEND_STRING PROPERTY LINK_FLAGS " /LARGEADDRESSAWARE"
)
target_link_options(retdectool PUBLIC "/LARGEADDRESSAWARE")
endif()
elseif(APPLE)
target_link_libraries(retdectool
Expand Down

0 comments on commit 7fa4753

Please sign in to comment.