[U] Updated cmake files

This commit is contained in:
seleznevae 2019-09-21 10:38:56 +03:00
parent e4adeed195
commit f221f3f297
3 changed files with 28 additions and 16 deletions

View File

@ -136,7 +136,7 @@ endforeach()
# ------------------------------------------------------------------------------
# Add WChar support for the build
# Add wchar and UTF-8 support for the build
# ------------------------------------------------------------------------------
if(NOT FORT_ENABLE_WCHAR)
add_definitions(-DFT_CONGIG_DISABLE_WCHAR)
@ -174,7 +174,7 @@ add_custom_target(headers SOURCES ${FortHeaders})
# ------------------------------------------------------------------------------
# Set preprocessor macros for all test builds
# Set preprocessor macros for all test builds.
# ------------------------------------------------------------------------------
target_compile_definitions(${PROJECT_NAME}_test_dev PRIVATE FT_TEST_BUILD=1)
@ -182,7 +182,7 @@ target_compile_definitions(${PROJECT_NAME}_test_cpp PRIVATE FT_TEST_BUILD=1)
target_compile_definitions(${PROJECT_NAME}_test PRIVATE FT_TEST_BUILD=1)
# ------------------------------------------------------------------------------
# Astyle
# Setup text formatting via astyle.
# ------------------------------------------------------------------------------
if(FORT_ENABLE_ASTYLE)
@ -248,13 +248,13 @@ endif()
# ------------------------------------------------------------------------------
# Tests
# Add examples and unit tests to ctest driver.
# ------------------------------------------------------------------------------
enable_testing()
add_test(NAME ${PROJECT_NAME}_ex COMMAND ${PROJECT_NAME}_ex)
add_test(NAME ${PROJECT_NAME}_print_styles COMMAND ${PROJECT_NAME}_print_styles)
add_test(NAME ${PROJECT_NAME}_ex_cpp COMMAND ${PROJECT_NAME}_ex_cpp)
add_test(NAME ${PROJECT_NAME}_test COMMAND ${PROJECT_NAME}_test)
add_test(NAME ${PROJECT_NAME}_test_cpp COMMAND ${PROJECT_NAME}_test_cpp)
add_test(NAME ${PROJECT_NAME}_test_dev COMMAND ${PROJECT_NAME}_test_dev)
list(APPEND ${PROJECT_NAME}_ctests
${${PROJECT_NAME}_tests}
${${PROJECT_NAME}_examples})
foreach(exe ${${PROJECT_NAME}_ctests})
add_test(NAME ${exe} COMMAND ${exe})
endforeach()

View File

@ -14,8 +14,14 @@ add_executable(${PROJECT_NAME}_ex_cpp
target_link_libraries(${PROJECT_NAME}_ex_cpp
fort)
set(${PROJECT_NAME}_examples
${PROJECT_NAME}_ex
${PROJECT_NAME}_print_styles
${PROJECT_NAME}_ex_cpp
PARENT_SCOPE)
if(DEFINED FORT_LINK_LIBRARIES)
target_link_libraries(${PROJECT_NAME}_ex "${FORT_LINK_LIBRARIES}")
target_link_libraries(${PROJECT_NAME}_print_styles "${FORT_LINK_LIBRARIES}")
target_link_libraries(${PROJECT_NAME}_ex_cpp "${FORT_LINK_LIBRARIES}")
foreach(exe ${${PROJECT_NAME}_examples})
target_link_libraries(${exe} "${FORT_LINK_LIBRARIES}")
endforeach()
endif()

View File

@ -53,8 +53,14 @@ target_include_directories(${PROJECT_NAME}_test_cpp
${CMAKE_CURRENT_SOURCE_DIR}
)
set(${PROJECT_NAME}_tests
${PROJECT_NAME}_test_dev
${PROJECT_NAME}_test_cpp
${PROJECT_NAME}_test
PARENT_SCOPE)
if(DEFINED FORT_LINK_LIBRARIES)
target_link_libraries(${PROJECT_NAME}_test_dev "${FORT_LINK_LIBRARIES}")
target_link_libraries(${PROJECT_NAME}_test_cpp "${FORT_LINK_LIBRARIES}")
target_link_libraries(${PROJECT_NAME}_test "${FORT_LINK_LIBRARIES}")
foreach(exe ${${PROJECT_NAME}_tests})
target_link_libraries(${exe} "${FORT_LINK_LIBRARIES}")
endforeach()
endif()