|
1 | | -cmake_minimum_required(VERSION 2.8.11) |
| 1 | +cmake_minimum_required(VERSION 2.8.11) |
2 | 2 |
|
3 | 3 | set(CMAKE_BUILD_TYPE_INIT Release) |
4 | 4 |
|
@@ -102,6 +102,7 @@ endif() |
102 | 102 | option(WITH_SYSTEM_LZO "Use the system LZO library instead of 'thirdpary'" ${_init_SYSTEM_LZO}) |
103 | 103 | option(WITH_SYSTEM_SUPERLU "Use the system SuperLU library instead of 'thirdpary'" ${_init_SYSTEM_SUPERLU}) |
104 | 104 | option(WITH_CANON "Build with Canon DSLR support - Requires Canon SDK" OFF) |
| 105 | +option(WITH_TRANSLATION "Generate translation projects as well" ON) |
105 | 106 |
|
106 | 107 | # avoid using again |
107 | 108 | option_defaults_clear() |
@@ -198,6 +199,11 @@ elseif(BUILD_ENV_UNIXLIKE) |
198 | 199 | endif() |
199 | 200 | if(CMAKE_SYSTEM_NAME MATCHES "Linux") |
200 | 201 | add_definitions(-DLINUX) |
| 202 | + elseif(CMAKE_SYSTEM_NAME MATCHES "^.*BSD$|DragonFly") |
| 203 | + set(BUILD_TARGET_BSD ON) |
| 204 | + add_definitions(-D_BSD_SOURCE -DFREEBSD) |
| 205 | + include_directories("/usr/local/include/") |
| 206 | + message(STATUS "Configuring for BSD system") |
201 | 207 | elseif(NOT BUILD_TARGET_WIN) |
202 | 208 | message(WARNING "Support for generic Unix (Not Apple or Linux) isn't yet working!") |
203 | 209 | endif() |
@@ -394,7 +400,11 @@ elseif(BUILD_ENV_APPLE) |
394 | 400 | if(GLEW-NOTFOUND) |
395 | 401 | pkg_check_modules(GLEW REQUIRED glew) |
396 | 402 | endif() |
397 | | - set(GLEW_LIB ${GLEW_LIBRARIES}) |
| 403 | + if (TARGET GLEW::GLEW) |
| 404 | + set(GLEW_LIB GLEW::GLEW) |
| 405 | + else() |
| 406 | + set(GLEW_LIB ${GLEW_LIBRARIES}) |
| 407 | + endif() |
398 | 408 |
|
399 | 409 | pkg_check_modules(LZ4_LIB REQUIRED liblz4) |
400 | 410 |
|
@@ -442,7 +452,9 @@ elseif(BUILD_ENV_UNIXLIKE) |
442 | 452 | endif() |
443 | 453 | find_library(Z_LIB z) |
444 | 454 |
|
445 | | - find_package(TIFF REQUIRED) |
| 455 | + if(NOT BUILD_TARGET_BSD) |
| 456 | + find_package(TIFF REQUIRED) |
| 457 | + endif() |
446 | 458 | find_package(PNG REQUIRED) |
447 | 459 | set(PNG_LIB ${PNG_LIBRARY}) |
448 | 460 | message("******* libpng:" ${PNG_LIB}) |
@@ -591,26 +603,28 @@ if(BUILD_ENV_MSVC AND MSVC_VERSION EQUAL 1800) |
591 | 603 | add_compile_options("/wd4819") |
592 | 604 | endif() |
593 | 605 |
|
594 | | -# generate Qt translations and messages |
595 | | -set(LANGUAGES japanese italian french spanish chinese german russian korean czech) |
596 | | - |
597 | | -function(add_translation module) |
598 | | - set(translation) |
599 | | - foreach(lang ${LANGUAGES}) |
600 | | - set(name "${CMAKE_SOURCE_DIR}/translations/${lang}/${module}.ts") |
601 | | - list(APPEND translation ${name}) |
602 | | - set_source_files_properties(${name} PROPERTIES |
603 | | - OUTPUT_LOCATION "${CMAKE_BINARY_DIR}/loc/${lang}" |
| 606 | +if(WITH_TRANSLATION) |
| 607 | + # generate Qt translations and messages |
| 608 | + set(LANGUAGES japanese italian french spanish chinese german russian korean czech) |
| 609 | + |
| 610 | + function(add_translation module) |
| 611 | + set(translation) |
| 612 | + foreach(lang ${LANGUAGES}) |
| 613 | + set(name "${CMAKE_SOURCE_DIR}/translations/${lang}/${module}.ts") |
| 614 | + list(APPEND translation ${name}) |
| 615 | + set_source_files_properties(${name} PROPERTIES |
| 616 | + OUTPUT_LOCATION "${CMAKE_BINARY_DIR}/loc/${lang}" |
| 617 | + ) |
| 618 | + endforeach() |
| 619 | + |
| 620 | + qt5_create_translation(message ${translation} ${ARGN}) |
| 621 | + |
| 622 | + add_custom_target("translation_${module}" DEPENDS ${message}) |
| 623 | + set_target_properties("translation_${module}" PROPERTIES |
| 624 | + EXCLUDE_FROM_DEFAULT_BUILD TRUE |
604 | 625 | ) |
605 | | - endforeach() |
606 | | - |
607 | | - qt5_create_translation(message ${translation} ${ARGN}) |
608 | | - |
609 | | - add_custom_target("translation_${module}" DEPENDS ${message}) |
610 | | - set_target_properties("translation_${module}" PROPERTIES |
611 | | - EXCLUDE_FROM_DEFAULT_BUILD TRUE |
612 | | - ) |
613 | | -endfunction() |
| 626 | + endfunction() |
| 627 | +endif() |
614 | 628 |
|
615 | 629 | set(CMAKE_C_FLAGS "${C_WARNINGS} ${CMAKE_C_FLAGS}") |
616 | 630 | set(CMAKE_CXX_FLAGS "${CXX_WARNINGS} ${CMAKE_CXX_FLAGS}") |
|
0 commit comments