-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
a couple of minor? adjustments #7
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,22 +5,38 @@ | |
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | ||
# | ||
|
||
# CMake build control file for json_spirit | ||
# Created following settings in Jamroot and libs/json/test/Jamfile | ||
|
||
cmake_minimum_required( VERSION 2.8 ) | ||
|
||
project( json_spirit ) | ||
|
||
if( CMAKE_COMPILER_IS_GNUCXX ) | ||
message(STATUS "compiler is ${CMAKE_CXX_COMPILER_ID}" ) | ||
|
||
if( CMAKE_CXX_COMPILER_ID STREQUAL "GNU" ) | ||
add_definitions( -ftemplate-depth=300 ) | ||
elseif( MSVC ) | ||
elseif( CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" ) | ||
add_definitions( /wd4996 ) | ||
elseif( CMAKE_CXX_COMPILER_ID STREQUAL "Clang" ) | ||
set (CMAKE_CXX_FLAGS "-std=c++11 -DBOOST_SPIRIT_USE_PHOENIX_V3=1" ) | ||
set (CMAKE_CXX_FLAGS_DEBUG "-g -O0" ) | ||
set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -O3" ) | ||
endif() | ||
|
||
if( CMAKE_HOST_APPLE ) | ||
set (CMAKE_OSX_ARCHITECTURES "x86_64" ) | ||
endif() | ||
|
||
find_package( Boost COMPONENTS unit_test_framework REQUIRED ) | ||
find_package(Boost) | ||
|
||
# this didn't work for me | ||
# find_package( Boost COMPONENTS unit_test_framework REQUIRED ) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This lets CMake know that (for the unit tests) the Boost unit_test_framework component needs to be built, and ensures it gets added to the list of libraries to be linked. It can find it from BOOST_ROOT, normally. What didn't work for you? I might be able to diagnose from the error message. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I should say the component needs to have been built - unlike Boost.build, CMake will not do this for you |
||
|
||
link_directories( | ||
"${BOOST_ROOT}/stage64/lib" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps this is related to the previous issue... at any rate this is Apple-specific and I'd want to at least condition it accordingly |
||
) | ||
|
||
include_directories( . ${Boost_INCLUDE_DIRS} ) | ||
|
||
set(BUILD_SHARED_LIBS false) | ||
file( GLOB SRC_FILES libs/json/src/*.cpp ) | ||
add_library( json STATIC ${SRC_FILES} ) | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,31 +8,15 @@ | |
# CMake build control file for json_spirit tests | ||
include_directories( ../../.. ) | ||
|
||
add_definitions( -DBOOST_TEST_DYN_LINK ) | ||
|
||
if( CMAKE_HOST_WIN32 ) | ||
# Copy Boost dlls to the test binary directories so they can be found | ||
set( blibs ${Boost_LIBRARIES} ) | ||
while( blibs ) | ||
list( GET blibs 0 cfg ) | ||
list( GET blibs 1 libpath ) | ||
# create the corresponding dll name (libpath will be .lib) | ||
get_filename_component( dllname ${libpath} NAME_WE ) | ||
get_filename_component( dllpath ${libpath} PATH ) | ||
set( dllpath "${dllpath}/${dllname}.dll" ) | ||
if( cfg STREQUAL optimized ) | ||
file( COPY ${dllpath} DESTINATION Release ) | ||
else() | ||
file( COPY ${dllpath} DESTINATION Debug ) | ||
endif() | ||
list( REMOVE_AT blibs 0 1 ) | ||
endwhile() | ||
endif() | ||
|
||
foreach( tname | ||
construct value_basic value_array value_object value_non_container get get_as parser_test ) | ||
construct value_basic value_array value_object value_non_container get get_as parser_test | ||
) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can't remove Windows support, although at some level I sympathize :) |
||
add_executable( ${tname} ${tname}.cpp ) | ||
target_link_libraries( ${tname} json ${Boost_LIBRARIES} ) | ||
target_link_libraries( ${tname} | ||
json | ||
debug libboost_unit_test_framework-clang-darwin-mt-d-1_55.a | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the find_package with the unit_test_framework had succeeded, Boost_LIBRARIES would have contained the names and paths of these libraries without any need to hardcode them. So I think we need to start with why that's not working. |
||
optimized libboost_unit_test_framework-clang-darwin-mt-d-1_55.a | ||
) | ||
add_test( ${tname} ${tname} ) | ||
endforeach() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hope we can leave this one out