Revert asm_offset CMake code to work with 3.10
authorCharles Giessen <charles@lunarg.com>
Wed, 28 Dec 2022 01:40:34 +0000 (18:40 -0700)
committerCharles Giessen <46324611+charles-lunarg@users.noreply.github.com>
Wed, 28 Dec 2022 16:20:41 +0000 (09:20 -0700)
The revertion of gen_defines.asm generation during cross compilation changed the
form of add_custom_command used, which inadvertently relied on CMake 3.16 support.

From the CMake Docs:
DEPENDS:
...
A target-level dependency is added if any dependency is a byproduct of a target or
any of its build events in the same directory to ensure the byproducts will be
available before this target is built.

loader/CMakeLists.txt

index 10fa787..eb6032c 100644 (file)
@@ -157,9 +157,7 @@ if(WIN32)
         target_link_libraries(asm_offset PRIVATE loader_specific_options)
         # If not cross compiling, run asm_offset to generage gen_defines.asm
         if (NOT CMAKE_CROSSCOMPILING)
-            add_custom_command(TARGET asm_offset POST_BUILD
-                COMMAND asm_offset MASM
-                BYPRODUCTS gen_defines.asm)
+            add_custom_command(OUTPUT gen_defines.asm DEPENDS asm_offset COMMAND asm_offset MASM)
         else()
             # Forces compiler to write the intermediate asm file, needed so that we can get sizeof/offset of info out of it.
             target_compile_options(asm_offset PRIVATE "/Fa$<TARGET_FILE_DIR:asm_offset>/asm_offset.asm" /FA)
@@ -233,9 +231,7 @@ else() # i.e.: Linux
         target_link_libraries(asm_offset loader_specific_options)
         # If not cross compiling, run asm_offset to generage gen_defines.asm
         if (NOT CMAKE_CROSSCOMPILING)
-            add_custom_command(TARGET asm_offset POST_BUILD
-                COMMAND asm_offset GAS
-                BYPRODUCTS gen_defines.asm)
+            add_custom_command(OUTPUT gen_defines.asm DEPENDS asm_offset COMMAND asm_offset GAS)
         else()
             # Forces compiler to write the intermediate asm file, needed so that we can get sizeof/offset of info out of it.
             target_compile_options(asm_offset PRIVATE -save-temps=obj)