abdes / cryptopp-cmake

A modern CMake build project for Crypto++ (https://github.com/weidai11/cryptopp).
BSD 3-Clause "New" or "Revised" License
118 stars 43 forks source link

Amending the Visual Studio generator + asm build workaround #117

Closed tsdalton closed 7 months ago

tsdalton commented 7 months ago

This pull request amends the workaround fix made in https://github.com/abdes/cryptopp-cmake/pull/20. It seems that with CMake 28+ this is no longer an issue. I have not tested earlier versions of CMake but this comment https://github.com/abdes/cryptopp-cmake/issues/13#issuecomment-1231692123 reports seeing the issue with CMake version 3.23.1.

The reason for making this amendment is that the original workaround appears to prevent us from referring to ${TARGET_OBJECTS:cryptopp} as below:

add_subdirectory(thirdparty/cryptopp-cmake)
add_library(mylib
    STATIC
        ${SOURCES}
        $<TARGET_OBJECTS:cryptopp>)

The linker is unable to find the asm object file:

LINK : fatal error LNK1181: cannot open input file 'D:\projects\libbcml\build\_deps\cryptopp-cmake-build\cryptopp\cryptopp.dir\Release\__\crypto++\rdrand.asm.obj'
tsdalton commented 7 months ago

Closing since this issue is in fact not resolved with newer versions of CMake, I was mistaken 😅. But the main linker error I referred to above is indeed a problem. I have opted to just switch to Ninja which seems to work fine.