Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Nathan Moinvaziri edited this pageJan 19, 2024 ·3 revisions

Common Build Problems

How to Statically Link Runtime Library

CMake

macOS/Linux

cmake -S . -B build -D CMAKE_EXE_LINKER_FLAGS=-static -D CMAKE_SHARED_LINKER_FLAGS=-static

MSVC

Use CMake'sCMAKE_MSVC_RUNTIME_LIBRARY option:

cmake -S . -B build -D CMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded

Configure

export LDFLAGS=-static./configure

How to Build into Your CMake project

If you are building from zlib sources with CMake:

project(myproject)add_subdirectory(zlib zlibEXCLUDE_FROM_ALL)# Use EXCLUDE_FROM_ALL to prevent all targets from being added to the solutionadd_executable(myproject myproject.c)target_link_libraries(myprojectPRIVATE zlibstatic)# Or "zlib" depending on whether or not you want the shared/static library

If you are using system libraries:

project(myproject)find_package(ZLIB REQUIRED)add_executable(myproject myproject.c)target_link_libraries(myprojectPRIVATE ZLIB::ZLIB)

[8]ページ先頭

©2009-2025 Movatter.jp