Use CMake to create resources/out directory

This commit is contained in:
Jimmy Nguyen 2017-02-21 12:00:38 -08:00
parent 969b8c2234
commit 6bf64fb149
2 changed files with 3 additions and 18 deletions

View File

@ -96,9 +96,11 @@ else(BUILD_STATIC_LIBS)
target_link_libraries(xmltest tinyxml2_static) target_link_libraries(xmltest tinyxml2_static)
endif() endif()
# Copy test resources # Copy test resources and create test output directory
add_custom_command(TARGET xmltest POST_BUILD add_custom_command(TARGET xmltest POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/resources ${CMAKE_BINARY_DIR}/resources COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/resources ${CMAKE_BINARY_DIR}/resources
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/resources/out
COMMENT "Configuring xmltest resources directory: ${CMAKE_BINARY_DIR}/resources"
) )
install(FILES tinyxml2.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) install(FILES tinyxml2.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})

View File

@ -10,16 +10,10 @@
#include <ctime> #include <ctime>
#if defined( _MSC_VER ) #if defined( _MSC_VER )
#include <direct.h> // _mkdir
#include <crtdbg.h> #include <crtdbg.h>
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>
_CrtMemState startMemState; _CrtMemState startMemState;
_CrtMemState endMemState;
#elif defined(MINGW32) || defined(__MINGW32__)
#include <io.h> // mkdir
#else
#include <sys/stat.h> // mkdir
#endif #endif
using namespace tinyxml2; using namespace tinyxml2;
@ -299,17 +293,6 @@ int main( int argc, const char ** argv )
_CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_LEAK_CHECK_DF); _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_LEAK_CHECK_DF);
#endif #endif
#if defined(_MSC_VER) || defined(MINGW32) || defined(__MINGW32__)
#if defined __MINGW64_VERSION_MAJOR && defined __MINGW64_VERSION_MINOR
//MINGW64: both 32 and 64-bit
mkdir( "resources/out/" );
#else
_mkdir( "resources/out/" );
#endif
#else
mkdir( "resources/out/", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
#endif
{ {
TIXMLASSERT( true ); TIXMLASSERT( true );
} }