# Part of the apollo library -- Copyright (c) Christian Neumüller 2015
# This file is subject to the terms of the BSD 2-Clause License.
# See LICENSE.txt or http://opensource.org/licenses/BSD-2-Clause

add_library(testutil STATIC
    testutil.hpp testutil.cpp
    test_prefix.hpp test_suffix.hpp)

target_link_libraries(testutil
    apollo ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})

needs_apollo_dll(testutil)

set (TESTS
    create_class
    create_table
    default_argument
    function_converters
    implicit_ctor
    lua_utils
    object_converters
    overloadset
    property
    reference
    simple_converters
    typeid
    ward_ptr
)

if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
    add_definitions("-Wno-global-constructors" "-Wno-exit-time-destructors")
endif()

foreach(test ${TESTS})
    add_executable(test_${test} test_${test}.cpp)
    target_link_libraries(test_${test} testutil)
    set_target_properties(test_${test} PROPERTIES
        FOLDER "Tests"
        COMPILE_DEFINITIONS "BOOST_TEST_MODULE=${test}")
    add_test(NAME ${test} COMMAND test_${test})
endforeach()

add_executable(benchmark "benchmark.cpp")
target_link_libraries(benchmark ${LUA_LIBRARIES} apollo)

# Part of the apollo library -- Copyright (c) Christian Neumüller 2015
# This file is subject to the terms of the BSD 2-Clause License.
# See LICENSE.txt or http://opensource.org/licenses/BSD-2-Clause

add_library(testutil STATIC
    testutil.hpp testutil.cpp
    test_prefix.hpp test_suffix.hpp)

target_link_libraries(testutil
    apollo ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})

needs_apollo_dll(testutil)

set (TESTS
    create_class
    create_table
    default_argument
    function_converters
    implicit_ctor
    lua_utils
    object_converters
    overloadset
    property
    reference
    simple_converters
    typeid
    ward_ptr
)

if (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
    add_definitions("-Wno-global-constructors" "-Wno-exit-time-destructors")
endif()

foreach(test ${TESTS})
    add_executable(test_${test} test_${test}.cpp)
    target_link_libraries(test_${test} testutil)
    set_target_properties(test_${test} PROPERTIES
        FOLDER "Tests"
        COMPILE_DEFINITIONS "BOOST_TEST_MODULE=${test}")
    add_test(NAME ${test} COMMAND test_${test})
endforeach()

add_executable(benchmark "benchmark.cpp")
target_link_libraries(benchmark ${LUA_LIBRARIES} apollo)

Fix CMake warning about quoted var in IF.
build: Fix CMake warning about quoted var in IF.

Message was:

> CMake Warning (dev) at test/CMakeLists.txt:30 (if):
>   Policy CMP0054 is not set: Only interpret if() arguments as variables or
>   keywords when unquoted.  Run "cmake --help-policy CMP0054" for policy
>   details.  Use the cmake_policy command to set the policy and suppress this
>   warning.
>
>   Quoted variables like "MSVC" will no longer be dereferenced when the policy
>   is set to NEW.  Since the policy is not set the OLD behavior will be used.
> This warning is for project developers.  Use -Wno-dev to suppress it.
