Skip to content

Commit

Permalink
Add an option to force static VC runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel-Cortez committed May 8, 2021
1 parent f5b189f commit bff2860
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions source/compiler/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_BUILD})
set(VERSION_STR ${VERSION})
math(EXPR VERSION_INT "${VERSION_MAJOR} << 8 | ${VERSION_MINOR}")

option(FORCE_STATIC_VCRT "Force static VC runtime" ON)

# check for optional include files
include(CheckIncludeFile)
check_include_file("unistd.h" HAVE_UNISTD_H)
Expand Down Expand Up @@ -162,6 +164,15 @@ if(MSVC)
${PROJECT_BINARY_DIR}/\${CMAKE_INSTALL_CONFIG_NAME}/pawncc.pdb
${PROJECT_BINARY_DIR}/\${CMAKE_INSTALL_CONFIG_NAME}/pawndisasm.pdb
DESTINATION bin)
# Force static runtime library
if(FORCE_STATIC_VCRT)
target_compile_options(pawnc PRIVATE
$<$<OR:$<CONFIG:Release>,$<CONFIG:MinSizeRel>>:/MT>
$<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:/MTd>)
target_compile_options(pawncc PRIVATE
$<$<OR:$<CONFIG:Release>,$<CONFIG:MinSizeRel>>:/MT>
$<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:/MTd>)
endif()
endif()

# Generate targets for running compiler tests
Expand Down

0 comments on commit bff2860

Please sign in to comment.