Quellcode durchsuchen

Use CMake to create resources/out directory

Jimmy Nguyen vor 9 Jahren
Ursprung
Commit
6bf64fb149
2 geänderte Dateien mit 3 neuen und 18 gelöschten Zeilen
  1. 3 1
      CMakeLists.txt
  2. 0 17
      xmltest.cpp

+ 3 - 1
CMakeLists.txt

@@ -96,9 +96,11 @@ else(BUILD_STATIC_LIBS)
    target_link_libraries(xmltest tinyxml2_static)
 endif()
 
-# Copy test resources
+# Copy test resources and create test output directory
 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 make_directory ${CMAKE_BINARY_DIR}/resources/out
+  COMMENT "Configuring xmltest resources directory: ${CMAKE_BINARY_DIR}/resources"
 )
 
 install(FILES tinyxml2.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})

+ 0 - 17
xmltest.cpp

@@ -10,16 +10,10 @@
 #include <ctime>
 
 #if defined( _MSC_VER )
-	#include <direct.h>		// _mkdir
 	#include <crtdbg.h>
 	#define WIN32_LEAN_AND_MEAN
 	#include <windows.h>
 	_CrtMemState startMemState;
-	_CrtMemState endMemState;
-#elif defined(MINGW32) || defined(__MINGW32__)
-    #include <io.h>  // mkdir
-#else
-	#include <sys/stat.h>	// mkdir
 #endif
 
 using namespace tinyxml2;
@@ -299,17 +293,6 @@ int main( int argc, const char ** argv )
 		_CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_LEAK_CHECK_DF);
 	#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 );
 	}