CMAKE_MINIMUM_REQUIRED (VERSION 3.0)

SET ( RBDL_ADDON_GEOMETRY_TESTS_VERSION_MAJOR 1 )
SET ( RBDL_ADDON_GEOMETRY_TESTS_VERSION_MINOR 0 )
SET ( RBDL_ADDON_GEOMETRY_TESTS_VERSION_PATCH 0 )

SET ( RBDL_ADDON_GEOMETRY_TESTS_VERSION 
	${RBDL_ADDON_GEOMETRY_TESTS_VERSION_MAJOR}.${RBDL_ADDON_GEOMETRY_TESTS_VERSION_MINOR}.${RBDL_ADDON_GEOMETRY_TESTS_VERSION_PATCH}
)


PROJECT (RBDL_GEOMETRY_TESTS VERSION ${RBDL_ADDON_GEOMETRY_TESTS_VERSION})

# Needed for UnitTest++
LIST( APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../CMake )

# Look for unittest++
FIND_PACKAGE (UnitTest++ REQUIRED)
INCLUDE_DIRECTORIES (${UNITTEST++_INCLUDE_DIR})

SET ( GEOMETRY_TESTS_SRCS
	testSmoothSegmentedFunction.cc
	numericalTestFunctions.cc
	numericalTestFunctions.h
	../geometry.h
	../SegmentedQuinticBezierToolkit.h
	../SmoothSegmentedFunction.h
	../SegmentedQuinticBezierToolkit.cc
	../SmoothSegmentedFunction.cc
	)

INCLUDE_DIRECTORIES ( ../ )


SET_TARGET_PROPERTIES ( ${PROJECT_EXECUTABLES} PROPERTIES
  LINKER_LANGUAGE CXX
)

ADD_EXECUTABLE ( rbdl_geometry_tests ${GEOMETRY_TESTS_SRCS} )

SET_TARGET_PROPERTIES ( rbdl_geometry_tests PROPERTIES
	LINKER_LANGUAGE CXX
	OUTPUT_NAME runGeometryTests
	)

SET (RBDL_LIBRARY rbdl)
IF (RBDL_BUILD_STATIC)
	SET (RBDL_LIBRARY rbdl-static)
ENDIF (RBDL_BUILD_STATIC)

TARGET_LINK_LIBRARIES ( rbdl_geometry_tests
		${UNITTEST++_LIBRARY}
		${RBDL_LIBRARY}
	)
	
OPTION (RUN_AUTOMATIC_TESTS "Perform automatic tests after compilation?" OFF)

IF (RUN_AUTOMATIC_TESTS)
ADD_CUSTOM_COMMAND (TARGET rbdl_geometry_tests
	POST_BUILD
	COMMAND ./runGeometryTests
	COMMENT "Running automated addon geometry tests..."
	)
ENDIF (RUN_AUTOMATIC_TESTS)
