CMakeLists.txt 1.51 KB
Newer Older
1
cmake_minimum_required(VERSION 3.10)
2

3
project("GeneticImages"
4 5 6 7
  VERSION 0.1
  DESCRIPTION "Recreate reference images with genetic algorithms"
  HOMEPAGE_URL "https://labs.phundrak.fr/phundrak/genetic-images"
  LANGUAGES CXX)
8

9 10
set(CMAKE_CXX_COMPILER /usr/bin/clang++)

11
file(GLOB SRC_FILES "src/*.cc")
12 13 14 15 16 17 18 19

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")

include(functions)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()

enable_cxx_compiler_flag_if_supported("-Wall")
20 21 22
enable_cxx_compiler_flag_if_supported("-Wextra")
enable_cxx_compiler_flag_if_supported("-Wshadow")
enable_cxx_compiler_flag_if_supported("-Wpedantic")
23
enable_cxx_compiler_flag_if_supported("-pedantic")
24
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
25
  enable_cxx_compiler_flag_if_supported("-O0")
26
  enable_cxx_compiler_flag_if_supported("-g")
27 28
  enable_cxx_compiler_flag_if_supported("-pg")
  enable_cxx_compiler_flag_if_supported("-finstrument-functions")
29 30 31 32
else()
  enable_cxx_compiler_flag_if_supported("-O3")
  enable_cxx_compiler_flag_if_supported("-flto")
endif()
33 34

# include_directories(<PUBLIC HEADER DIRECTORIES>)
35 36

# Main software
37 38 39 40
set(TGT genetic-image)
add_executable(${TGT} ${SRC_FILES})
target_compile_features(${TGT} PRIVATE cxx_std_17)
target_include_directories(${TGT} PRIVATE include/genimg)
41
target_link_libraries(${TGT} ${CONAN_LIBS} stdc++fs)
42

43 44 45
# OS specific instructions.
if(APPLE)
elseif(WIN32)
46 47 48 49 50
  # Windows developer environment specific instructions.
  if(MINGW)
  elseif(MSYS)
  elseif(CYGWIN)
  endif()
51 52 53
elseif(UNIX)
else()
endif()