Skip to content

Commit

Permalink
use header lib
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarthianur committed Feb 18, 2021
1 parent c98f9f6 commit 72f83ef
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ if (NOT DEFINED TPP_PROJECT_SELF)
set(TPP_PROJECT_SELF OFF)
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(TPP_PROJECT_SELF ON)
message(STATUS "TestPlusPlus is the project itself")
message(STATUS "TestPlusPlus is itself the project")
endif ()
endif ()

option(TPP_INTERNAL "Generate internal project targets" ${TPP_PROJECT_SELF})

add_library(tpp INTERFACE)
target_include_directories(tpp INTERFACE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>)

if(TPP_INTERNAL)
if(NOT "${CMAKE_CXX_STANDARD}")
set(CMAKE_CXX_STANDARD 11)
Expand All @@ -21,17 +24,15 @@ if(TPP_INTERNAL)
set(CMAKE_BUILD_TYPE staged)
set(CMAKE_CXX_FLAGS_STAGED "-Wall -Wextra -Wpedantic -Werror -Wnon-virtual-dtor -Wno-unused-function -Wno-unknown-pragmas -O0 -g")

file(GLOB_RECURSE sources test/*.cpp)
file(GLOB_RECURSE sources ${PROJECT_SOURCE_DIR}/test/*.cpp)

add_executable(test_seq ${sources})
target_compile_options(test_seq PUBLIC --coverage)
target_include_directories(test_seq PUBLIC ${PROJECT_SOURCE_DIR}/include)
target_link_libraries(test_seq PUBLIC gcov)
target_link_libraries(test_seq PUBLIC gcov tpp)

add_executable(test_par ${sources})
target_compile_options(test_par PUBLIC -fopenmp --coverage)
target_include_directories(test_par PUBLIC ${PROJECT_SOURCE_DIR}/include)
target_link_libraries(test_par PUBLIC gcov gomp)
target_link_libraries(test_par PUBLIC gcov gomp tpp)

add_executable(rel_test_seq ${sources})
target_compile_options(rel_test_seq PUBLIC --coverage)
Expand All @@ -45,8 +46,7 @@ if(TPP_INTERNAL)

add_executable(compiledb_dummy ${sources})
target_compile_options(compiledb_dummy PUBLIC -fopenmp)
target_include_directories(compiledb_dummy PUBLIC ${PROJECT_SOURCE_DIR}/include)
target_link_libraries(compiledb_dummy PUBLIC gomp)
target_link_libraries(compiledb_dummy PUBLIC gomp tpp)

if("${GENERATE_COMPILEDB}")
if(NOT "${COMPILEDB_TARGET}")
Expand All @@ -55,6 +55,3 @@ if(TPP_INTERNAL)
execute_process(COMMAND compiledb --command-style -n make -C ${CMAKE_BINARY_DIR} ${COMPILEDB_TARGET})
endif()
endif()

add_library(tpp INTERFACE)
target_include_directories(tpp INTERFACE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>)

0 comments on commit 72f83ef

Please sign in to comment.