CMakeLists.txt 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. cmake_minimum_required( VERSION 3.10 )
  2. project( CloudCompareProjects )
  3. # One shouldn't generate the BUILD project directly in the SOURCES folder!
  4. if ( ${CMAKE_CURRENT_BINARY_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR} )
  5. if ( NOT SAME_BUILD_AND_SOURCE_FOLDER_WARNING_ALREADY_ISSUED )
  6. message(FATAL_ERROR "It is not advised to BUILD the binaries directly in the SOURCE folder!\n If you want to proceed with this option, just CONFIGURE the project once again" )
  7. set( SAME_BUILD_AND_SOURCE_FOLDER_WARNING_ALREADY_ISSUED TRUE )
  8. endif()
  9. endif()
  10. # Add our cmake module path so we don't need relative paths for these
  11. list( APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/" )
  12. include( CMakePolicies )
  13. include( CMakeSetCompilerOptions )
  14. include( DeployQt )
  15. # CCViewer
  16. option( OPTION_BUILD_CCVIEWER "Check to compile CCViewer project" ON )
  17. # Testing
  18. option( BUILD_TESTING "Build tests for CC" OFF )
  19. if ( BUILD_TESTING )
  20. include( CTest )
  21. endif()
  22. # Default debug suffix for libraries.
  23. set( CMAKE_DEBUG_POSTFIX "d" )
  24. # Define target folders
  25. # (now that ccViewer can have its own plugins, qCC and ccViewer must fall in separate folders!
  26. if(WIN32 OR APPLE)
  27. set( CLOUDCOMPARE_DEST_FOLDER CloudCompare )
  28. set( CCVIEWER_DEST_FOLDER ccViewer )
  29. else()
  30. set( CLOUDCOMPARE_DEST_FOLDER bin )
  31. set( CCVIEWER_DEST_FOLDER bin )
  32. endif()
  33. if( WIN32 )
  34. set( INSTALL_DESTINATIONS ${CLOUDCOMPARE_DEST_FOLDER} )
  35. if( ${OPTION_BUILD_CCVIEWER} )
  36. list( APPEND INSTALL_DESTINATIONS ${CCVIEWER_DEST_FOLDER} )
  37. endif()
  38. elseif( UNIX AND NOT APPLE )
  39. # RPATH Linux/Unix: (dynamic) libs are put in $prefix/$lib/cloudcompare,
  40. # since they are only used by qCC/ccViewer
  41. include( GNUInstallDirs )
  42. set( LINUX_INSTALL_SHARED_DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/cloudcompare" )
  43. set( CMAKE_INSTALL_RPATH ${LINUX_INSTALL_SHARED_DESTINATION} )
  44. set( INSTALL_DESTINATIONS ${CMAKE_INSTALL_PREFIX})
  45. endif()
  46. # Load advanced scripts
  47. include( CMakeInclude )
  48. include( Install )
  49. # Add external libraries
  50. include( CMakeExternalLibs )
  51. # Internal libs used by both CloudCompare & ccViewer
  52. add_subdirectory( libs )
  53. # Plugins
  54. add_subdirectory( plugins )
  55. # qCC
  56. add_subdirectory( qCC )
  57. # CCViewer
  58. if( OPTION_BUILD_CCVIEWER )
  59. add_subdirectory( ccViewer )
  60. endif()