Boost unit test framework is always available
[platform/core/security/device-certificate-manager.git] / tests / CMakeLists.txt
index bae6eb4..fb35fbd 100644 (file)
@@ -1,29 +1,42 @@
-include_directories(../dcm-client ../shared ../dcm-daemon)
-include_directories(${CMAKE_BINARY_DIR}/dcm-client)
+# Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+#
+#    Licensed under the Apache License, Version 2.0 (the "License");
+#    you may not use this file except in compliance with the License.
+#    You may obtain a copy of the License at
+#
+#        http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing, software
+#    distributed under the License is distributed on an "AS IS" BASIS,
+#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#    See the License for the specific language governing permissions and
+#    limitations under the License.
+#
+# @file        tests/CMakeLists.txt
+# @author      Dariusz Michaluk <d.michaluk@samsung.com>
+# @author      Jaroslaw Pelczar <j.pelczar@samsung.com>
 
-include_directories(${Boost_INCLUDE_DIRS})
-link_directories(${Boost_LIBRARY_DIRS})
+INCLUDE_DIRECTORIES(../dcm-client ../shared ${CMAKE_BINARY_DIR}/dcm-client)
+
+INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
+LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
 
 ADD_DEFINITIONS(-DBOOST_LOG_DYN_LINK)
 ADD_DEFINITIONS(-DBOOST_TEST_DYN_LINK)
 
-add_executable(dcm_example_client example_client.cpp)
-target_link_libraries(dcm_example_client device-certificate-manager)
-
-add_executable(dcm_example_capi example_capi.c)
-target_link_libraries(dcm_example_capi device-certificate-manager)
+ADD_EXECUTABLE(dcm_example_capi example_capi.c)
+TARGET_LINK_LIBRARIES(dcm_example_capi device-certificate-manager)
 
-install(TARGETS dcm_example_client dcm_example_capi
-       RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+ADD_EXECUTABLE(dcm_example_client example_client.cpp)
+TARGET_LINK_LIBRARIES(dcm_example_client device-certificate-manager)
 
-IF(Boost_UNIT_TEST_FRAMEWORK_FOUND)
-       add_executable(dcm_api_test api_test.cpp)
-       target_link_libraries(dcm_api_test
-                       device-certificate-manager
-                       ${Boost_UNIT_TEST_FRAMEWORK_LIBRARIES})
+ADD_EXECUTABLE(dcm_api_test api_test.cpp)
+TARGET_LINK_LIBRARIES(dcm_api_test
+       device-certificate-manager
+       ${Boost_UNIT_TEST_FRAMEWORK_LIBRARIES})
 
-       install(TARGETS dcm_api_test
-               RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
-ELSE()
-       message(STATUS "Boost::test library not found. Disabling unit test build")
-ENDIF()
+INSTALL(TARGETS
+       dcm_example_capi
+       dcm_example_client
+       dcm_api_test
+       RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})