Skip to content

Commit

Permalink
Testing VIII
Browse files Browse the repository at this point in the history
Making sure that CMake builds statically, so users without the required development DLLs can run the program.
  • Loading branch information
Mileter committed Jun 27, 2024
1 parent c641366 commit 771edb2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ project(formatter)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED True)

if(CMAKE_CXX_COMPILER_ID EQUAL "MSVC")
set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib")
target_compile_options(your_target_name [PUBLIC|PRIVATE] /MT)
target_link_options(your_target_name [PUBLIC|PRIVATE] /INCREMENTAL:NO /NODEFAULTLIB:MSVCRT)
else()
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
set(BUILD_SHARED_LIBS OFF)
set(CMAKE_EXE_LINKER_FLAGS "-static")
endif()

# Add the executable
add_executable(formatter main.cpp kern/kern.cpp)

Expand Down

0 comments on commit 771edb2

Please sign in to comment.