Files
CMake/Modules/Platform/Windows.cmake
Yonggang Luo be848a71b0 MSVC: Teach find_library to consider the 'libfoo.a' naming convention
When targeting the GNU ABI, we consider `.a` libraries first but also
accept `.lib`.  For symmetry, when targeting the MSVC ABI, we now
consider `.lib` first but also accept `.a`.

This adds support for meson-generated static libraries, which are named
with the pattern `lib${foo}.a`:

* https://mesonbuild.com/FAQ.html#why-does-building-my-project-with-msvc-output-static-libraries-called-libfooa

Fixes: #23975
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
2022-09-19 11:02:44 -04:00

46 lines
1.4 KiB
CMake

set(WIN32 1)
if(CMAKE_SYSTEM_NAME STREQUAL "WindowsCE")
set(WINCE 1)
elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone")
set(WINDOWS_PHONE 1)
elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
set(WINDOWS_STORE 1)
endif()
set(CMAKE_STATIC_LIBRARY_PREFIX "")
set(CMAKE_STATIC_LIBRARY_SUFFIX ".lib")
set(CMAKE_SHARED_LIBRARY_PREFIX "") # lib
set(CMAKE_SHARED_LIBRARY_SUFFIX ".dll") # .so
set(CMAKE_IMPORT_LIBRARY_PREFIX "")
set(CMAKE_IMPORT_LIBRARY_SUFFIX ".lib")
set(CMAKE_EXECUTABLE_SUFFIX ".exe") # .exe
set(CMAKE_LINK_LIBRARY_SUFFIX ".lib")
set(CMAKE_DL_LIBS "")
set(CMAKE_EXTRA_LINK_EXTENSIONS ".targets")
set(CMAKE_FIND_LIBRARY_PREFIXES "" "lib")
set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".a")
# for borland make long command lines are redirected to a file
# with the following syntax, see Windows-bcc32.cmake for use
if(CMAKE_GENERATOR MATCHES "Borland")
set(CMAKE_START_TEMP_FILE "@&&|\n")
set(CMAKE_END_TEMP_FILE "\n|")
endif()
# for nmake make long command lines are redirected to a file
# with the following syntax, see Windows-bcc32.cmake for use
if(CMAKE_GENERATOR MATCHES "NMake")
set(CMAKE_START_TEMP_FILE "@<<\n")
set(CMAKE_END_TEMP_FILE "\n<<")
endif()
include(Platform/WindowsPaths)
# uncomment these out to debug nmake and borland makefiles
#set(CMAKE_START_TEMP_FILE "")
#set(CMAKE_END_TEMP_FILE "")
#set(CMAKE_VERBOSE_MAKEFILE 1)