File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # vim: et ts=4 sts=4 sw=4 tw=0
12
23IF (JSONCPP_LIB_BUILD_SHARED)
34 ADD_DEFINITIONS ( -DJSON_DLL )
@@ -22,9 +23,19 @@ ENDIF(JSONCPP_LIB_BUILD_SHARED)
2223# Run unit tests in post-build
2324# (default cmake workflow hides away the test result into a file, resulting in poor dev workflow?!?)
2425IF (JSONCPP_WITH_POST_BUILD_UNITTEST)
25- ADD_CUSTOM_COMMAND ( TARGET jsoncpp_test
26- POST_BUILD
27- COMMAND $<TARGET_FILE :jsoncpp_test >)
26+ IF (JSONCPP_LIB_BUILD_SHARED)
27+ # First, copy the shared lib, for Microsoft.
28+ # Then, run the test executable.
29+ ADD_CUSTOM_COMMAND ( TARGET jsoncpp_test
30+ POST_BUILD
31+ COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE :jsoncpp_lib > $<TARGET_FILE_DIR :jsoncpp_test >
32+ COMMAND $<TARGET_FILE :jsoncpp_test >)
33+ ELSE (JSONCPP_LIB_BUILD_SHARED )
34+ # Just run the test executable.
35+ ADD_CUSTOM_COMMAND ( TARGET jsoncpp_test
36+ POST_BUILD
37+ COMMAND $<TARGET_FILE :jsoncpp_test >)
38+ ENDIF (JSONCPP_LIB_BUILD_SHARED )
2839ENDIF (JSONCPP_WITH_POST_BUILD_UNITTEST )
2940
3041SET_TARGET_PROPERTIES (jsoncpp_test PROPERTIES OUTPUT_NAME jsoncpp_test )
You can’t perform that action at this time.
0 commit comments