Does anyone know how to get CMake to add linker flags?
Previously I would call make like this: make CONFIG=Release TARGET_ARCH="-latomic -m64"
But I don’t know where to add this info in CMake.
I’ve tried adding this at the bottom of the CMakeLists.txt file but it doesn’t seem to modify the generated makefile at all…
if (LINUX)
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE "-latomic -m64")
endif()
I guess that’s what I get from too much Stack Overflow.
Is there a reliable Linux CMake variable? I use if (MSVC) and if (APPLE) but now I’m wondering if those aren’t actually being called either
MSVC and APPLE are standard CMake variables, but you might want to double check what they mean. For instance, MSVC doesn’t mean “Windows”, since you could be using Clang or MinGW. And APPLE means all Apple platforms, not just macOS.