Commit 10e4ac08 authored by Martin Heistermann's avatar Martin Heistermann

cmake: prefix common targets with OVM_ when built in subdir; simplify doxygen

parent 6a09c460
Pipeline #12000 failed with stage
in 4 minutes and 52 seconds
......@@ -16,8 +16,6 @@ else()
set(OVM_STANDALONE_BUILD FALSE)
endif()
#message("OVM_STANDALONE_BUILD: ${OVM_STANDALONE_BUILD}")
set(OVM_ENABLE_UNITTESTS ${OVM_STANDALONE_BUILD} CACHE BOOL "Build OpenVolumeMesh unit tests in 'all' target")
set(OVM_ENABLE_EXAMPLES ${OVM_STANDALONE_BUILD} CACHE BOOL "Build OpenVolumeMesh examples in 'all' target")
set(OVM_BUILD_DOCUMENTATION ${OVM_STANDALONE_BUILD} CACHE BOOL "Build OpenVolumeMesh documentation in 'all' target")
......@@ -25,19 +23,15 @@ set(OVM_BUILD_DOCUMENTATION ${OVM_STANDALONE_BUILD} CACHE BOOL "Build OpenVolume
set(OVM_CXX_VERSION 14 CACHE STRING "C++ version to use")
set_property(CACHE OVM_CXX_VERSION PROPERTY STRINGS 14 17 20)
if (CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
if (WIN32)
set (ACG_PROJECT_LIBDIR "lib")
set (ACG_PROJECT_BINDIR ".")
else ()
set (ACG_PROJECT_LIBDIR "lib")
set (ACG_PROJECT_BINDIR "bin")
endif ()
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Build/${ACG_PROJECT_BINDIR}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Build/${ACG_PROJECT_LIBDIR}")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Build/${ACG_PROJECT_LIBDIR}")
if (OVM_STANDALONE_BUILD)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Build/bin")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Build/lib")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Build/lib")
set(OVM_TARGET_PREFIX "")
else()
# OVM_TARGET_PREFIX is prepended to targets with generic names,
# i.e., "doc", "unittests"
set(OVM_TARGET_PREFIX "OVM_")
endif()
set (CMAKE_DEBUG_POSTFIX "d")
......
if (NOT TARGET doc)
include (ACGDoxygen)
find_package(Doxygen REQUIRED dot)
set(TARGET_NAME "${OVM_TARGET_PREFIX}doc")
#find_package(Doxygen REQUIRED dot)
if (DOXYGEN_FOUND)
set(DOXYGEN_PROJECT_LOGO "${CMAKE_CURRENT_SOURCE_DIR}/html/logo_vci.png")
set(DOXYGEN_IMAGE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/images")
set(DOXYGEN_WARN_IF_UNDOCUMENTED "FALSE")
set(DOXYGEN_CITE_BIB_FILES "${CMAKE_CURRENT_SOURCE_DIR}/references.bib")
IF (DOXYGEN_FOUND)
if (TARGET doc)
# TODO
#acg_copy_after_build (doc "${CMAKE_CURRENT_SOURCE_DIR}/html" "${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/Doc/html")
endif ()
# Add a documentation install target
add_custom_target(doc-install COMMENT "Installing Documentation" VERBATIM )
# Build Documentation before installing it
add_dependencies(doc-install doc)
if (TARGET doc-install)
# TODO
# acg_copy_after_build (doc-install "${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/Doc/html" "${CMAKE_INSTALL_PREFIX}/${ACG_PROJECT_DATADIR}/doc/html")
if (${ACG_PROJECT_DATADIR})
set(DOXYGEN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/Doc/html")
else()
set(DOXYGEN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/Build/share/doc/OpenVolumeMesh")
endif()
ENDIF(DOXYGEN_FOUND)
ENDIF()
doxygen_add_docs(${TARGET_NAME} "${CMAKE_CURRENT_SOURCE_DIR}/..")
endif()
......@@ -9,20 +9,22 @@ SET(SOURCE_FILES
find_package(OpenVolumeMesh REQUIRED)
set(TARGET_NAME "${OVM_TARGET_PREFIX}unittests")
enable_testing()
find_package(GTest)
if(GTEST_FOUND)
include(GoogleTest)
add_executable(unittests ${SOURCE_FILES})
add_executable(${TARGET_NAME} ${SOURCE_FILES})
target_link_libraries(unittests
OpenVolumeMesh::OpenVolumeMesh
GTest::GTest
GTest::Main
)
gtest_add_tests(TARGET unittests
gtest_add_tests(TARGET ${TARGET_NAME}
EXTRA_ARGS "--gtest_color=yes;--gtest_output=xml"
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/Unittests"
)
......@@ -31,7 +33,7 @@ if(GTEST_FOUND)
DESTINATION "${CMAKE_BINARY_DIR}/Unittests"
)
set_target_properties(unittests PROPERTIES
set_target_properties(${TARGET_NAME} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Unittests
CXX_STANDARD ${OVM_CXX_VERSION}
CXX_STANDARD_REQUIRED YES
......@@ -40,7 +42,7 @@ if(GTEST_FOUND)
#[[=
if ( WIN32 )
add_custom_command (TARGET unittests POST_BUILD
add_custom_command (TARGET ${TARGET_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E
copy_if_different
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/unittests.exe
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment