Fix some configuration issues with VS2012

This commit is contained in:
Pavel Krajcevski 2013-11-17 14:17:00 -05:00
parent bfce1c8b9d
commit 86741f7a89
4 changed files with 19 additions and 1 deletions

View file

@ -59,6 +59,12 @@ SET(TESTS
FOREACH(TEST ${TESTS})
SET(TEST_NAME Test_Base_${TEST})
SET(TEST_MODULE Test${TEST}.cpp)
# HACK for MSVC 2012...
IF(MSVC)
ADD_DEFINITIONS(-D_VARIADIC_MAX=10)
ENDIF()
ADD_EXECUTABLE(${TEST_NAME} ${TEST_MODULE})
TARGET_LINK_LIBRARIES(${TEST_NAME} FasTCBase)
TARGET_LINK_LIBRARIES(${TEST_NAME} gtest_main)

View file

@ -98,7 +98,7 @@ void ExtractBasename(const char *filename, char *buf, size_t bufSz) {
}
}
uint64 numChars = ext - base + 1;
size_t numChars = ext - base + 1;
size_t toCopy = ::std::min(numChars, bufSz);
memcpy(buf, base, toCopy);
buf[toCopy - 1] = '\0';

View file

@ -71,6 +71,7 @@ macro(config_compiler_and_linker)
set(cxx_exception_flags "-EHsc -D_HAS_EXCEPTIONS=1")
set(cxx_no_exception_flags "-D_HAS_EXCEPTIONS=0")
set(cxx_no_rtti_flags "-GR-")
add_definitions(-D_VARIADIC_MAX=10)
elseif (CMAKE_COMPILER_IS_GNUCXX)
set(cxx_base_flags "-Wall -Wshadow")
set(cxx_exception_flags "-fexceptions")

View file

@ -63,6 +63,12 @@ SET(TESTS
FOREACH(TEST ${TESTS})
SET(TEST_NAME Test_PVRTCEncoder_${TEST})
SET(TEST_MODULE ${TEST}Test.cpp)
# HACK for MSVC 2012...
IF(MSVC)
ADD_DEFINITIONS(-D_VARIADIC_MAX=10)
ENDIF()
ADD_EXECUTABLE(${TEST_NAME} ${TEST_MODULE})
TARGET_LINK_LIBRARIES(${TEST_NAME} PVRTCEncoder)
TARGET_LINK_LIBRARIES(${TEST_NAME} gtest_main)
@ -91,6 +97,11 @@ IF(PVRTEXLIB_FOUND)
INCLUDE_DIRECTORIES( ${PVRTEXLIB_INCLUDE_DIRS} )
INCLUDE_DIRECTORIES( ${FasTC_SOURCE_DIR}/Core/include )
# HACK for MSVC 2012...
IF(MSVC)
ADD_DEFINITIONS(-D_VARIADIC_MAX=10)
ENDIF()
# The cpp file to compile for the test
ADD_EXECUTABLE(${TEST_NAME} DecompTestPVR.cpp)