|
1 | 1 | # Common functions and settings for LSL |
2 | 2 |
|
3 | | -# Dummy function that should be called after find_package(LSL) |
4 | | -# Does nothing at the moment, but the entire code below should be within this |
5 | | -# function so it's not executed by accident |
| 3 | +option(LSL_DEPLOYAPPLIBS "Copy library dependencies (at the moment Qt + liblsl) to the installation dir" ON) |
| 4 | +option(LSL_COMFY_DEFAULTS "Set some quality of life options, e.g. a sensible 'install' directory" OFF) |
| 5 | + |
6 | 6 | macro(LSLAPP_Setup_Boilerplate) |
| 7 | + message(WARNING "This function is deprecated, set LSL_COMFY_DEFAULTS instead") |
| 8 | + set(LSL_COMFY_DEFAULTS ON) |
7 | 9 | endmacro() |
8 | 10 |
|
| 11 | +# helper script to determine the target architecture for package naming |
| 12 | +# The code below is compiled with the target compiler so it should work even |
| 13 | +# when cross compiling and doesn't require the executable to be run |
9 | 14 | function(LSL_get_target_arch) |
10 | 15 | if(LSL_ARCH) |
11 | 16 | return() |
@@ -40,28 +45,25 @@ function(LSL_get_target_arch) |
40 | 45 | set(LSL_ARCH "${ARCH}" CACHE INTERNAL "target architecture") |
41 | 46 | endfunction() |
42 | 47 |
|
43 | | -message(STATUS "Included LSL CMake helpers, rev. 14, ${CMAKE_CURRENT_LIST_DIR}") |
44 | | -option(LSL_DEPLOYAPPLIBS "Copy library dependencies (at the moment Qt + liblsl) to the installation dir" ON) |
| 48 | +message(STATUS "Included LSL CMake helpers, rev. 15, ${CMAKE_CURRENT_LIST_DIR}") |
45 | 49 |
|
46 | 50 | # set build type and default install dir if not done already or undesired |
47 | | -if(NOT CMAKE_BUILD_TYPE) |
| 51 | +if(LSL_COMFY_DEFAULTS AND NOT CMAKE_BUILD_TYPE) |
48 | 52 | message(STATUS "CMAKE_BUILD_TYPE was default initialized to Release") |
49 | 53 | set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type" FORCE) |
50 | 54 | endif() |
51 | | -if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND NOT LSL_PRESERVE_INSTALL_PREFIX) |
| 55 | +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND COMFY_DEFAULTS) |
52 | 56 | set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH |
53 | 57 | "Where to put redistributable binaries" FORCE) |
54 | | - message(WARNING "CMAKE_INSTALL_PREFIX default initialized to ${CMAKE_INSTALL_PREFIX}. Set LSL_PRESERVE_INSTALL_PREFIX or CMAKE_INSTALL_PREFIX to skip this.") |
55 | 58 | endif() |
56 | 59 |
|
57 | | -# Generate folders for IDE targets (e.g., VisualStudio solutions) |
58 | | -set_property(GLOBAL PROPERTY USE_FOLDERS ON) |
| 60 | +if(LSL_COMFY_DEFAULTS) |
| 61 | + # Generate folders for IDE targets (e.g., VisualStudio solutions) |
| 62 | + set_property(GLOBAL PROPERTY USE_FOLDERS ON) |
59 | 63 |
|
60 | | - |
61 | | -set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "limited configs" FORCE) |
62 | | - |
63 | | -# Qt5 |
64 | | -set(CMAKE_INCLUDE_CURRENT_DIR ON) # Because the ui_mainwindow.h file. |
| 64 | + # Qt5, include e.g. "mainwindow.h" |
| 65 | + set(CMAKE_INCLUDE_CURRENT_DIR ON) |
| 66 | +endif() |
65 | 67 |
|
66 | 68 | # LSL functions, mostly for Apps |
67 | 69 |
|
|
0 commit comments