Skip to content

Commit f26edb0

Browse files
authored
Merge pull request #630 from jschueller/appveyor
Fix shared/static lib build conflict resolves #631
2 parents cadb6dd + ffdcc93 commit f26edb0

File tree

2 files changed

+18
-27
lines changed

2 files changed

+18
-27
lines changed

appveyor.yml

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,17 @@
1-
# This is a comment.
2-
3-
version: build.{build}
4-
5-
os: Windows Server 2012 R2
6-
71
clone_folder: c:\projects\jsoncpp
82

9-
platform:
10-
- Win32
11-
- x64
12-
13-
configuration:
14-
- Debug
15-
- Release
16-
17-
# scripts to run before build
18-
before_build:
19-
- echo "Running cmake..."
20-
- cd c:\projects\jsoncpp
21-
- cmake --version
22-
- set PATH=C:\Program Files (x86)\MSBuild\14.0\Bin;%PATH%
23-
- if %PLATFORM% == Win32 cmake .
24-
- if %PLATFORM% == x64 cmake -G "Visual Studio 12 2013 Win64" .
25-
26-
build:
27-
project: jsoncpp.sln # path to Visual Studio solution or project
3+
environment:
4+
matrix:
5+
- CMAKE_GENERATOR: Visual Studio 12 2013
6+
- CMAKE_GENERATOR: Visual Studio 12 2013 Win64
7+
- CMAKE_GENERATOR: Visual Studio 14 2015
8+
- CMAKE_GENERATOR: Visual Studio 14 2015 Win64
9+
10+
build_script:
11+
- cmake --version
12+
- cd c:\projects\jsoncpp
13+
- cmake -G "%CMAKE_GENERATOR%" -DCMAKE_INSTALL_PREFIX=%CD:\=/%/install -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON .
14+
- cmake --build . --config Release --target install
2815

2916
deploy:
3017
provider: GitHub

src/lib_json/CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,12 @@ ENDIF()
9595
IF(BUILD_STATIC_LIBS)
9696
ADD_LIBRARY(jsoncpp_lib_static STATIC ${PUBLIC_HEADERS} ${jsoncpp_sources})
9797
SET_TARGET_PROPERTIES( jsoncpp_lib_static PROPERTIES VERSION ${JSONCPP_VERSION} SOVERSION ${JSONCPP_SOVERSION})
98-
SET_TARGET_PROPERTIES( jsoncpp_lib_static PROPERTIES OUTPUT_NAME jsoncpp
99-
DEBUG_OUTPUT_NAME jsoncpp${DEBUG_LIBNAME_SUFFIX} )
98+
# avoid name clashes on windows as the shared import lib is also named jsoncpp.lib
99+
if (NOT DEFINED STATIC_SUFFIX AND BUILD_SHARED_LIBS)
100+
set (STATIC_SUFFIX "_static")
101+
endif ()
102+
set_target_properties (jsoncpp_lib_static PROPERTIES OUTPUT_NAME jsoncpp${STATIC_SUFFIX}
103+
DEBUG_OUTPUT_NAME jsoncpp${STATIC_SUFFIX}${DEBUG_LIBNAME_SUFFIX})
100104

101105
INSTALL( TARGETS jsoncpp_lib_static ${INSTALL_EXPORT}
102106
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}

0 commit comments

Comments
 (0)