xref: /reactos/sdk/lib/crt/oldnames.cmake (revision 1734f297)
1
2if(NOT MSVC)
3    # Use the same trick as with the other import libs. See gcc.cmake --> generate_import_lib function
4    set(LIBRARY_PRIVATE_DIR ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/oldnames.dir)
5    add_custom_command(
6        OUTPUT ${LIBRARY_PRIVATE_DIR}/oldnames.a
7        # ar just puts stuff into the archive, without looking twice. Just delete the lib, we're going to rebuild it anyway
8        COMMAND ${CMAKE_COMMAND} -E rm -f $<TARGET_FILE:oldnames>
9        COMMAND ${CMAKE_DLLTOOL} --def ${CMAKE_CURRENT_SOURCE_DIR}/moldname-msvcrt.def --kill-at --output-lib=oldnames.a -t oldnames
10        DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/moldname-msvcrt.def
11        WORKING_DIRECTORY ${LIBRARY_PRIVATE_DIR})
12    set_source_files_properties(
13        ${LIBRARY_PRIVATE_DIR}/oldnames.a
14        PROPERTIES
15        EXTERNAL_OBJECT TRUE)
16
17    _add_library(oldnames STATIC EXCLUDE_FROM_ALL ${LIBRARY_PRIVATE_DIR}/oldnames.a)
18    set_target_properties(oldnames PROPERTIES LINKER_LANGUAGE "C")
19else()
20    add_asm_files(oldnames_asm oldnames-msvcrt.S)
21    add_library(oldnames ${oldnames_asm})
22    set_target_properties(oldnames PROPERTIES LINKER_LANGUAGE "C")
23endif()
24