Adding option for MSVC for those who are linking statically.
This commit is contained in:
parent
68e201add8
commit
19a19d1952
@ -53,6 +53,12 @@ project (jansson C)
|
|||||||
# Options
|
# Options
|
||||||
OPTION (BUILD_SHARED_LIBS "Build shared libraries." OFF)
|
OPTION (BUILD_SHARED_LIBS "Build shared libraries." OFF)
|
||||||
|
|
||||||
|
IF(MSVC)
|
||||||
|
# This option must match the settings used in your program, in particular if you
|
||||||
|
# are linking statically
|
||||||
|
OPTION( STATIC_CRT "Link the static CRT libraries" OFF )
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
# Set some nicer output dirs.
|
# Set some nicer output dirs.
|
||||||
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
|
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
|
||||||
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
|
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
|
||||||
@ -84,15 +90,24 @@ include (CheckFunctionKeywords)
|
|||||||
include (CheckIncludeFiles)
|
include (CheckIncludeFiles)
|
||||||
include (CheckTypeSize)
|
include (CheckTypeSize)
|
||||||
|
|
||||||
# Turn off Microsofts "security" warnings.
|
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
|
# Turn off Microsofts "security" warnings.
|
||||||
add_definitions( "/W3 /D_CRT_SECURE_NO_WARNINGS /wd4005 /wd4996 /nologo" )
|
add_definitions( "/W3 /D_CRT_SECURE_NO_WARNINGS /wd4005 /wd4996 /nologo" )
|
||||||
|
|
||||||
|
if (STATIC_CRT)
|
||||||
|
set(CMAKE_C_FLAGS_RELEASE "/MT")
|
||||||
|
set(CMAKE_C_FLAGS_DEBUG "/MTd")
|
||||||
|
endif()
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
|
if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
|
||||||
set(CMAKE_C_FLAGS "-fPIC")
|
set(CMAKE_C_FLAGS "-fPIC")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Check for the int-type includes
|
# Check for the int-type includes
|
||||||
check_include_files (sys/types.h HAVE_SYS_TYPES_H)
|
check_include_files (sys/types.h HAVE_SYS_TYPES_H)
|
||||||
check_include_files (inttypes.h HAVE_INTTYPES_H)
|
check_include_files (inttypes.h HAVE_INTTYPES_H)
|
||||||
|
Loading…
Reference in New Issue
Block a user