Tests only on cmake option
This commit is contained in:
parent
02702874f6
commit
9192e89241
@ -7,7 +7,6 @@ project("GeneticImages"
|
||||
LANGUAGES CXX)
|
||||
|
||||
file(GLOB SRC_FILES "src/*.cc")
|
||||
file(GLOB TEST_FILES "tests/tests.cc")
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
|
||||
|
||||
@ -21,16 +20,23 @@ enable_cxx_compiler_flag_if_supported("-O3")
|
||||
enable_cxx_compiler_flag_if_supported("-flto")
|
||||
|
||||
# include_directories(<PUBLIC HEADER DIRECTORIES>)
|
||||
|
||||
# Main software
|
||||
set(TGT genetic-image)
|
||||
set(TESTTGT genetic-image-tests)
|
||||
add_executable(${TGT} ${SRC_FILES})
|
||||
add_executable(${TESTTGT} ${TEST_FILES})
|
||||
target_compile_features(${TGT} PRIVATE cxx_std_17)
|
||||
target_compile_features(${TESTTGT} PRIVATE cxx_std_17)
|
||||
target_include_directories(${TGT} PRIVATE include/genimg)
|
||||
target_include_directories(${TESTTGT} PRIVATE include/genimg)
|
||||
target_link_libraries(${TGT} ${CONAN_LIBS} stdc++fs)
|
||||
target_link_libraries(${TESTTGT} ${CONAN_LIBS} stdc++fs)
|
||||
|
||||
# Tests
|
||||
if(TESTS)
|
||||
set(TESTTGT genetic-image-tests)
|
||||
file(GLOB TEST_FILES "tests/tests.cc")
|
||||
add_executable(${TESTTGT} ${TEST_FILES})
|
||||
target_compile_features(${TESTTGT} PRIVATE cxx_std_17)
|
||||
target_include_directories(${TESTTGT} PRIVATE include/genimg)
|
||||
target_link_libraries(${TESTTGT} ${CONAN_LIBS} stdc++fs)
|
||||
endif()
|
||||
|
||||
# OS specific instructions.
|
||||
if(APPLE)
|
||||
|
@ -73,6 +73,12 @@ following line instead of the second line:
|
||||
#+begin_src shell
|
||||
conan install .. --build missing --profile <your_profile>
|
||||
#+end_src
|
||||
If you wish to build the project’s tests in addition to the project itself, you
|
||||
can add the option ~-DTESTS=True~ to the first ~cmake~ command to build the
|
||||
project’s tests too.
|
||||
#+begin_src shell
|
||||
cmake -DCMAKE_CXX_COMPILER=clang++ -DTESTS=True .. -G Ninja
|
||||
#+end_src
|
||||
|
||||
If you do not wish to build your project with Ninja but with another generator,
|
||||
such as Unix Makefiles, simply replace ~Ninja~ in the second to last ~cmake~
|
||||
|
Loading…
Reference in New Issue
Block a user