1# Copyright JS Foundation and other contributors, http://js.foundation 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15cmake_minimum_required (VERSION 2.8.12) 16project (unit-libm C) 17 18# Unit tests main modules 19file(GLOB SOURCE_UNIT_TEST_MAIN_MODULES *.c) 20 21# Unit tests declaration 22add_custom_target(unittests-libm) 23 24foreach(SOURCE_UNIT_TEST_MAIN ${SOURCE_UNIT_TEST_MAIN_MODULES}) 25 get_filename_component(TARGET_NAME ${SOURCE_UNIT_TEST_MAIN} NAME_WE) 26 set(TARGET_NAME unit-${TARGET_NAME}) 27 28 add_executable(${TARGET_NAME} ${SOURCE_UNIT_TEST_MAIN}) 29 set_property(TARGET ${TARGET_NAME} PROPERTY LINK_FLAGS "${LINKER_FLAGS_COMMON}") 30 set_property(TARGET ${TARGET_NAME} PROPERTY RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/tests") 31 32 target_link_libraries(${TARGET_NAME} jerry-libm) 33 34 add_dependencies(unittests-libm ${TARGET_NAME}) 35endforeach() 36