Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
15a63e21
Commit
15a63e21
authored
Mar 18, 2013
by
Vicent Martí
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1418 from QbProg/qb/cmake-msvc
MSVC cmake improvements
parents
a5f61384
d66a7c06
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
4 deletions
+24
-4
CMakeLists.txt
+24
-4
No files found.
CMakeLists.txt
View file @
15a63e21
...
...
@@ -35,6 +35,10 @@ IF(MSVC)
# - Turn this off by invoking CMake with the "-DSTDCALL=Off" argument.
#
OPTION
(
STDCALL
"Build libgit2 with the __stdcall convention"
ON
)
# 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"
ON
)
ENDIF
()
# Installation paths
...
...
@@ -148,26 +152,36 @@ IF (MSVC)
SET
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
/Gz"
)
ENDIF
()
IF
(
STATIC_CRT
)
SET
(
CRT_FLAG_DEBUG
"/MTd"
)
SET
(
CRT_FLAG_RELEASE
"/MT"
)
ELSE
()
SET
(
CRT_FLAG_DEBUG
"/MDd"
)
SET
(
CRT_FLAG_RELEASE
"/MD"
)
ENDIF
()
# /Zi - Create debugging information
# /Od - Disable optimization
# /D_DEBUG - #define _DEBUG
# /MTd - Statically link the multithreaded debug version of the CRT
# /MDd - Dynamically link the multithreaded debug version of the CRT
# /RTC1 - Run time checks
SET
(
CMAKE_C_FLAGS_DEBUG
"/Zi /Od /D_DEBUG /
MTd /RTC1
"
)
SET
(
CMAKE_C_FLAGS_DEBUG
"/Zi /Od /D_DEBUG /
RTC1
${
CRT_FLAG_DEBUG
}
"
)
# /DNDEBUG - Disables asserts
# /MT - Statically link the multithreaded release version of the CRT
# /MD - Dynamically link the multithreaded release version of the CRT
# /O2 - Optimize for speed
# /Oy - Enable frame pointer omission (FPO) (otherwise CMake will automatically turn it off)
# /GL - Link time code generation (whole program optimization)
# /Gy - Function-level linking
SET
(
CMAKE_C_FLAGS_RELEASE
"/DNDEBUG /
MT /O2 /Oy /GL /Gy
"
)
SET
(
CMAKE_C_FLAGS_RELEASE
"/DNDEBUG /
O2 /Oy /GL /Gy
${
CRT_FLAG_RELEASE
}
"
)
# /Oy- - Disable frame pointer omission (FPO)
SET
(
CMAKE_C_FLAGS_RELWITHDEBINFO
"/DNDEBUG /Zi /
MT /O2 /Oy- /GL /Gy
"
)
SET
(
CMAKE_C_FLAGS_RELWITHDEBINFO
"/DNDEBUG /Zi /
O2 /Oy- /GL /Gy
${
CRT_FLAG_RELEASE
}
"
)
# /O1 - Optimize for size
SET
(
CMAKE_C_FLAGS_MINSIZEREL
"/DNDEBUG /
MT /O1 /Oy /GL /Gy
"
)
SET
(
CMAKE_C_FLAGS_MINSIZEREL
"/DNDEBUG /
O1 /Oy /GL /Gy
${
CRT_FLAG_RELEASE
}
"
)
# /DYNAMICBASE - Address space load randomization (ASLR)
# /NXCOMPAT - Data execution prevention (DEP)
...
...
@@ -268,6 +282,12 @@ ADD_LIBRARY(git2 ${SRC_GIT2} ${SRC_OS} ${SRC_ZLIB} ${SRC_HTTP} ${SRC_REGEX} ${SR
TARGET_LINK_LIBRARIES
(
git2
${
SSL_LIBRARIES
}
)
TARGET_OS_LIBRARIES
(
git2
)
# Workaround for Cmake bug #0011240 (see http://public.kitware.com/Bug/view.php?id=11240)
# Win64+MSVC+static libs = linker error
IF
(
MSVC AND NOT BUILD_SHARED_LIBS
AND
(
${
CMAKE_SIZEOF_VOID_P
}
MATCHES
"8"
)
)
SET_TARGET_PROPERTIES
(
git2 PROPERTIES STATIC_LIBRARY_FLAGS
"/MACHINE:x64"
)
ENDIF
()
MSVC_SPLIT_SOURCES
(
git2
)
IF
(
SONAME
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment