diff options
author | Nik Reist <zeroability@tutanota.com> | 2020-06-06 13:01:46 +0300 |
---|---|---|
committer | Davide Beatrici <git@davidebeatrici.dev> | 2020-07-11 20:37:21 +0300 |
commit | 13e61b4dc317e6b94962d57f4e1de46d26a5ebb3 (patch) | |
tree | e5a2cc3bf3aaae656f19ee2f5c90bbba855d66dc /overlay/overlay_exe | |
parent | 2ee48b07c0a446547727941bf3bda0d755cfb95c (diff) |
overlay: build 32 bit library also in 64 bit builds on Windows
GCC and Clang provide the "-m32" and "-m64" options, which tell the compiler to build as 32 bit and 64 bit, respectively.
Unfortunately MSVC doesn't provide similar options, thus this commit converts "overlay" from a subdirectory to a project.
If the build is 32 bit, the project is processed a single time and compiles a 32 bit library.
If the build is 64 bit, the project is processed two times and compiles a 64 bit and a 32 bit library.
Diffstat (limited to 'overlay/overlay_exe')
-rw-r--r-- | overlay/overlay_exe/CMakeLists.txt | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/overlay/overlay_exe/CMakeLists.txt b/overlay/overlay_exe/CMakeLists.txt index 53c71e80b..f3fc8e35c 100644 --- a/overlay/overlay_exe/CMakeLists.txt +++ b/overlay/overlay_exe/CMakeLists.txt @@ -8,13 +8,15 @@ set(OVERLAY_EXE_RC "overlay_exe.rc") add_definitions("-DUNICODE" "-DWIN32_LEAN_AND_MEAN") # We save the output name in a variable because it's used by configure_file() -if(64_BIT) +if(64_BIT AND NOT BUILD_OVERLAY_XCOMPILE) set(OUTPUT_NAME "mumble_ol_helper_x64") else() set(OUTPUT_NAME "mumble_ol_helper") endif() -get_target_property(MUMBLE_SOURCE_DIR mumble SOURCE_DIR) +if(NOT BUILD_OVERLAY_XCOMPILE) + get_target_property(MUMBLE_SOURCE_DIR mumble SOURCE_DIR) +endif() configure_file(${OVERLAY_EXE_RC} ${CMAKE_CURRENT_BINARY_DIR}) @@ -26,13 +28,22 @@ add_executable(overlay_exe WIN32 "${CMAKE_CURRENT_BINARY_DIR}/${OVERLAY_EXE_RC}" ) -set_property(TARGET overlay_exe PROPERTY OUTPUT_NAME ${OUTPUT_NAME}) -set_property(TARGET overlay_exe PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) +set_target_properties(overlay_exe PROPERTIES OUTPUT_NAME ${OUTPUT_NAME}) + +if(BUILD_OVERLAY_XCOMPILE) + set_target_properties(overlay_exe PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${MUMBLE_BINARY_DIR}) + + target_include_directories(overlay_exe PRIVATE ${PARENT_SOURCE_DIR}/overlay) +else() + set_target_properties(overlay_exe PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) + + target_include_directories(overlay_exe PRIVATE ${CMAKE_SOURCE_DIR}/overlay) +endif() if(MSVC) - set_property(TARGET overlay_exe PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") + set_target_properties(overlay_exe PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") endif() -find_library(LIB_SHLWAPI "shlwapi") -target_link_libraries(overlay_exe PRIVATE ${LIB_SHLWAPI}) +add_dependencies(overlay_exe overlay) +target_link_libraries(overlay_exe PRIVATE Shlwapi.lib) |