1
General / Cmake build issues: linker cannot find -loptimized and -ldebug
« on: April 10, 2024, 07:03:42 am »
I have been attempting to build SFML with cmake for integration with my own cmake build system to ensure that it works with any compiler for cross platform development. After messing around with different configurations, I have found a strange problem that I cannot find any solution to.
I am on windows 11, working with MSVC 2019 and Mingw32. To ensure that I am not the source of this error, I am using a fresh clone of https://github.com/SFML/cmake-sfml-project/. Configuring and compiling works fine for both systems, but when linking, I get the same error:
This is the MSVC 2019 error:
LINK : fatal error LNK1104: cannot open file 'optimized.lib'
and this is the Mingw32 error:
x86_64-w64-mingw32/bin/ld.exe: cannot find -loptimized: No such file or directory
x86_64-w64-mingw32/bin/ld.exe: cannot find -ldebug: No such file or directory
I don't think that there is an actual library named debug or optimized that is missing, instead some configuration is messed up somehow.
After some research, the only issue I could find this could be connected to is a way of specifying debug and release linking:
target_link_libraries(${PROJECT_NAME}
optimized mylib-release
debug mylib-debug
)
But after some digging, neither the template cmakeLists.txt nor the SFML build cmakeLists.txt includes anything in this format. I'm at a loss for what to do here.
I am on windows 11, working with MSVC 2019 and Mingw32. To ensure that I am not the source of this error, I am using a fresh clone of https://github.com/SFML/cmake-sfml-project/. Configuring and compiling works fine for both systems, but when linking, I get the same error:
This is the MSVC 2019 error:
LINK : fatal error LNK1104: cannot open file 'optimized.lib'
and this is the Mingw32 error:
x86_64-w64-mingw32/bin/ld.exe: cannot find -loptimized: No such file or directory
x86_64-w64-mingw32/bin/ld.exe: cannot find -ldebug: No such file or directory
I don't think that there is an actual library named debug or optimized that is missing, instead some configuration is messed up somehow.
After some research, the only issue I could find this could be connected to is a way of specifying debug and release linking:
target_link_libraries(${PROJECT_NAME}
optimized mylib-release
debug mylib-debug
)
But after some digging, neither the template cmakeLists.txt nor the SFML build cmakeLists.txt includes anything in this format. I'm at a loss for what to do here.