Unittests for windows
git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@427 fdac6126-5c0c-442c-9429-916003d36597
This commit is contained in:
@@ -16,12 +16,38 @@ if(GTEST_FOUND)
|
||||
link_directories(${GTEST_LIBRARY_DIR} )
|
||||
# Create new target named unittests_hexmeshing
|
||||
add_executable(unittests EXCLUDE_FROM_ALL unittests.cc)
|
||||
# Link against all necessary libraries
|
||||
target_link_libraries(unittests OpenMeshCore OpenMeshTools gtest gtest_main pthread)
|
||||
# Set output directory to ${BINARY_DIR}/Unittests
|
||||
set_target_properties(unittests PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Unittests)
|
||||
# Set compiler flags
|
||||
set_target_properties(unittests PROPERTIES COMPILE_FLAGS "-g -pedantic -ansi -Wno-long-long")
|
||||
|
||||
if ( NOT WIN32)
|
||||
# Link against all necessary libraries
|
||||
target_link_libraries(unittests OpenMeshCore OpenMeshTools ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES} pthread)
|
||||
|
||||
# Set output directory to ${BINARY_DIR}/Unittests
|
||||
set_target_properties(unittests PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Unittests)
|
||||
|
||||
else()
|
||||
# Link against all necessary libraries
|
||||
target_link_libraries(unittests OpenMeshCore OpenMeshTools ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES})
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
if ( NOT WIN32 )
|
||||
# Set compiler flags
|
||||
set_target_properties(unittests PROPERTIES COMPILE_FLAGS "-g -pedantic -ansi -Wno-long-long")
|
||||
else()
|
||||
# Set compiler flags
|
||||
set_target_properties(unittests PROPERTIES COMPILE_FLAGS "" )
|
||||
|
||||
# copy exe file to "Build" directory
|
||||
# Visual studio will create this file in a subdirectory so we can't use
|
||||
# RUNTIME_OUTPUT_DIRECTORY directly here
|
||||
add_custom_command (TARGET unittests POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E
|
||||
copy_if_different
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/unittests.exe
|
||||
${CMAKE_BINARY_DIR}/Unittests/unittests.exe)
|
||||
endif()
|
||||
|
||||
acg_copy_after_build(unittests ${CMAKE_CURRENT_SOURCE_DIR}/TestFiles ${CMAKE_BINARY_DIR}/Unittests/)
|
||||
|
||||
else(GTEST_FOUND)
|
||||
|
||||
Reference in New Issue
Block a user