Skip to content

Commit

Permalink
building on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
moony committed Jan 14, 2019
1 parent e235af5 commit 7a8e19b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@ json_map_demo/json_map_demo
json_test/json_test

build/
.vs/
_build/
CMakeSettings.json
13 changes: 9 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@ PROJECT(json_spirit)
SUBDIRS(json_spirit)
INCLUDE_DIRECTORIES(json_spirit)

OPTION(BUILD_STATIC_LIBRARIES "Build static libraries" OFF)
OPTION(BUILD_STATIC_LIBRARIES "Build static libraries" ON)

OPTION(JSON_SPIRIT_WVALUE_ENABLED "Build with support for unicode types" OFF)
OPTION(JSON_SPIRIT_MVALUE_ENABLED "Build with support for ascii map types" OFF)
OPTION(JSON_SPIRIT_WMVALUE_ENABLED "Build with support for unicode map types" OFF)
OPTION(JSON_SPIRIT_DEMOS "Enable building demos" ON)
OPTION(JSON_SPIRIT_TESTS "Enable building tests" ON)

if(WIN32)
SET(CMAKE_INSTALL_PREFIX D:/job/developlib)
endif()

include(GNUInstallDirs)

if(JSON_SPIRIT_DEMOS)
Expand Down Expand Up @@ -59,7 +63,6 @@ elseif(${CMAKE_CXX_COMPILER_ID} MATCHES Clang)
endif()

message(${CMAKE_INSTALL_INCLUDEDIR})


set(CPACK_PACKAGE_VERSION_MAJOR 4)
set(CPACK_PACKAGE_VERSION_MINOR 0)
Expand All @@ -83,8 +86,10 @@ INSTALL(
json_spirit/json_spirit_writer_template.h
json_spirit/json_spirit_writer_options.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/json_spirit)


if(WIN32)
else()
if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL )
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/json_spirit.pc DESTINATION "${INSTALL_PKGCONFIG_DIR}")
endif()

endif()
8 changes: 6 additions & 2 deletions json_spirit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,16 @@ FIND_PACKAGE(Boost 1.34 REQUIRED)
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIR})


OPTION(BUILD_STATIC_LIBS "Build static libraries" OFF)
OPTION(BUILD_STATIC_LIBS "Build static libraries" ON)

if(BUILD_STATIC_LIBS)
ADD_LIBRARY(json_spirit STATIC ${JSON_SPIRIT_SRCS})
install(TARGETS json_spirit ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
else(BUILD_STATIC_LIBS)
ADD_LIBRARY(json_spirit SHARED ${JSON_SPIRIT_SRCS})
install(TARGETS json_spirit LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
if(WIN32)
install(TARGETS json_spirit RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR})
else()
install(TARGETS json_spirit LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
endif(BUILD_STATIC_LIBS)

0 comments on commit 7a8e19b

Please sign in to comment.