Want more features on Pastebin? Sign Up, it's FREE!
Guest

Top-level CMakeLists.txt

By: a guest on Oct 22nd, 2012  |  syntax: CMake  |  size: 5.92 KB  |  views: 42  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. cmake_minimum_required(VERSION 2.6)
  2.  
  3. project("XYZ")
  4.  
  5. message("Building for ${CMAKE_SYSTEM_NAME}.")
  6.  
  7. set(VERSION_MAJOR "6")
  8. set(VERSION_MINOR "1")
  9. set(VERSION_PATCH "0")
  10. set(VERSION_HOTFIX "0")
  11. set(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.${VERSION_HOTFIX}")
  12.  
  13. set(CMAKE_RUNTIME_OUTPUT_DIRECTORY $ENV{XYZ_BUILD_DIR}/bin/$ENV{OSPLAT}/$ENV{OSREL}/$ENV{ARCH}/$ENV{ISA})
  14. set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE $ENV{XYZ_BUILD_DIR}/bin/$ENV{OSPLAT}/$ENV{OSREL}/$ENV{ARCH}/$ENV{ISA})
  15. set(RUNTIME_OUTPUT_DIRECTORY $ENV{XYZ_BUILD_DIR}/bin/$ENV{OSPLAT}/$ENV{OSREL}/$ENV{ARCH}/$ENV{ISA})
  16. set(RUNTIME_OUTPUT_DIRECTORY_RELEASE $ENV{XYZ_BUILD_DIR}/bin/$ENV{OSPLAT}/$ENV{OSREL}/$ENV{ARCH}/$ENV{ISA})
  17. set(CMAKE_LIBRARY_OUTPUT_DIRECTORY $ENV{XYZ_BUILD_DIR}/bin/$ENV{OSPLAT}/$ENV{OSREL}/$ENV{ARCH}/$ENV{ISA})
  18. set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE $ENV{XYZ_BUILD_DIR}/bin/$ENV{OSPLAT}/$ENV{OSREL}/$ENV{ARCH}/$ENV{ISA})
  19. set(LIBRARY_OUTPUT_DIRECTORY $ENV{XYZ_BUILD_DIR}/bin/$ENV{OSPLAT}/$ENV{OSREL}/$ENV{ARCH}/$ENV{ISA})
  20. set(LIBRARY_OUTPUT_DIRECTORY_RELEASE $ENV{XYZ_BUILD_DIR}/bin/$ENV{OSPLAT}/$ENV{OSREL}/$ENV{ARCH}/$ENV{ISA})
  21. set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY $ENV{XYZ_BUILD_DIR}/lib/$ENV{OSPLAT}/$ENV{OSREL}/$ENV{ARCH}/$ENV{ISA})
  22. set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE $ENV{XYZ_BUILD_DIR}/lib/$ENV{OSPLAT}/$ENV{OSREL}/$ENV{ARCH}/$ENV{ISA})
  23. set(ARCHIVE_OUTPUT_DIRECTORY $ENV{XYZ_BUILD_DIR}/lib/$ENV{OSPLAT}/$ENV{OSREL}/$ENV{ARCH}/$ENV{ISA})
  24. set(ARCHIVE_OUTPUT_DIRECTORY_RELEASE $ENV{XYZ_BUILD_DIR}/lib/$ENV{OSPLAT}/$ENV{OSREL}/$ENV{ARCH}/$ENV{ISA})
  25.  
  26. if(UNIX)
  27. set(EXECUTABLE_OUTPUT_PATH $ENV{XYZ_BUILD_DIR}/bin/$ENV{OSPLAT}/$ENV{OSREL}/$ENV{ARCH}/$ENV{ISA})
  28. set(LIBRARY_OUTPUT_PATH $ENV{XYZ_BUILD_DIR}/lib/$ENV{OSPLAT}/$ENV{OSREL}/$ENV{ARCH}/$ENV{ISA})
  29. set(ARCHIVE_OUTPUT_PATH $ENV{XYZ_BUILD_DIR}/lib/$ENV{OSPLAT}/$ENV{OSREL}/$ENV{ARCH}/$ENV{ISA})
  30. endif(UNIX)
  31.  
  32. string(TOLOWER $ENV{OSPLAT} OSPLAT2)
  33. string(TOUPPER ${OSPLAT2} OSPLAT3)
  34. string(REPLACE "." "" OSREL2 $ENV{OSREL})
  35.  
  36. if(UNIX)
  37. include_directories("$ENV{XYZ_BUILD_DIR}/src/include/primitives"
  38. "$ENV{XYZ_BUILD_DIR}/src/include/platform/unix"
  39. "$ENV{XYZ_BUILD_DIR}/src/include/platform/unix/${OSPLAT2}"
  40. "$ENV{XYZ_BUILD_DIR}/src/include/network"
  41. "$ENV{XYZ_BUILD_DIR}/src/include/security"
  42. "$ENV{XYZ_BUILD_DIR}/src/include/common"
  43. "$ENV{XYZ_BUILD_DIR}/src/include/commoncmd"
  44. "$ENV{XYZ_BUILD_DIR}/src/include/config"
  45. "$ENV{XYZ_BUILD_DIR}/src/include/httpc"
  46. "$ENV{XYZ_BUILD_DIR}/src/include/ehttpd"
  47. "$ENV{XYZ_BUILD_DIR}/src/include/schedtasks"
  48. "$ENV{ACXYZ_SIG_DIR}/src/include/ZzEATXYZ"
  49. "$ENV{I18N_BUILD_DIR}/src/include/common"
  50. "$ENV{I18N_BUILD_DIR}/src/include/unix")
  51.  
  52.  
  53. IF(NOT CMAKE_BUILD_TYPE)
  54.    SET(CMAKE_BUILD_TYPE "Release" CACHE STRING
  55.           "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE)
  56. ENDIF(NOT CMAKE_BUILD_TYPE)
  57.  
  58. add_definitions(-DCANCEL_SAFE -D__EXTERN_C__ -D__LICENSING__ -DNO_DBLAYER
  59. -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT -Dregister= -DUNIX -DV2_LICENSING
  60. -DPKGINFO_BUILD_DATE=$ENV{PKGINFO_BUILD_DATE}
  61. -DPKGINFO_VERSION=\"$ENV{PKGINFO_VERSION}\"
  62. -DPKGINFO_PSTAMP=\"$ENV{PKGINFO_PSTAMP}\")
  63. set(LINKER_LANGUAGE C)
  64. if(${CMAKE_SYSTEM_NAME} STREQUAL SunOS)
  65.  add_definitions(-DFD_SETSIZE=8192 -DSOLARIS -DNO_STRERROR_R)
  66.  set(VBS_CXX_FLAGS "-g -features=extensions -PIC -mt")
  67.  set(VBS_C_FLAGS "-g -KPIC")
  68.  set(CMAKE_EXE_LINKER_FLAGS "-norunpath -mt -KPIC")
  69.  set(VBS_LINK_LIBS "posix4")
  70.  list(APPEND VBS_LINK_LIBS "socket")
  71.  list(APPEND VBS_LINK_LIBS "gen")
  72.  list(APPEND VBS_LINK_LIBS "kstat")
  73. elseif(${CMAKE_SYSTEM_NAME} STREQUAL Linux)
  74.  add_definitions(-DFD_SETSIZE=8192 -DLINUX -D${OSPLAT3}_${OSREL2})
  75.  set(VBS_CXX_FLAGS "-g -Wall -Wno-unused -Wno-long-long -Wwrite-strings -fmessage-length=0")
  76.  set(VBS_C_FLAGS "-g -Wall -Wno-unused -Wno-long-long -Wwrite-strings -fmessage-length=0")
  77.  set(VBS_LINK_LIBS "crypt")
  78.  list(APPEND VBS_LINK_LIBS "rt")
  79. elseif(${CMAKE_SYSTEM_NAME} STREQUAL AIX)
  80.  add_definitions(-DHAVE_STRUCT_SOCKADDR_SA_LEN -DAIX)
  81.  set(VBS_CXX_FLAGS "-g -qstaticinline -qchars=signed -qrtti=all -qthreaded")
  82.  set(VBS_C_FLAGS "-g -qthreaded")
  83.  set(CMAKE_EXE_LINKER_FLAGS "-bnolibpath -bnoipath -qthreaded")
  84.  set(VBS_LINK_LIBS "iconv")
  85.  list(APPEND VBS_LINK_LIBS "perfstat")
  86. elseif(${CMAKE_SYSTEM_NAME} STREQUAL HP-UX)
  87.  add_definitions(-DHPUX1131 -DHPUX_1131_IA -DHPUX -DHP)
  88.  set(VBS_CXX_FLAGS "-g -AA +W829,612,749,495,67,2177,2111,4232,2186,2174,2128 +Z -mt")
  89.  set(VBS_C_FLAGS "-g +W829,612,749,495,67,2177,2111,4232,2186,2174,2128 +Z -mt")
  90.  set(CMAKE_EXE_LINKER_FLAGS "-AA -Wl,\"+b/usr/lib:\",\"+s\",-E -mt")
  91.   set(VBS_LINK_LIBS "nsl_s")
  92.   list(APPEND VBS_LINK_LIBS "dld")
  93. endif(${CMAKE_SYSTEM_NAME} STREQUAL SunOS)
  94. else(UNIX)
  95. if(WIN32)
  96. set(VBS_CXX_FLAGS "/Od /FAcs /TP /Zi")
  97. set(VBS_C_FLAGS "/Od /TC /Zi")
  98. set(CMAKE_EXE_LINKER_FLAGS, "/SAFESEH /IGNORE:4221 /NODEFAULTLIB:\"msvcrtd.lib\" /NODEFAULTLIB:\"libcmtd.lib\" /INCREMENTAL:NO")
  99.  
  100. include_directories("$ENV{XYZ_BUILD_DIR}/src/include/primitives"
  101. "$ENV{XYZ_BUILD_DIR}/src/include/platform/windows"
  102. "$ENV{XYZ_BUILD_DIR}/src/include/network"
  103. "$ENV{XYZ_BUILD_DIR}/src/include/security"
  104. "$ENV{XYZ_BUILD_DIR}/src/include/common"
  105. "$ENV{XYZ_BUILD_DIR}/src/include/commoncmd"
  106. "$ENV{XYZ_BUILD_DIR}/src/include/config"
  107. "$ENV{XYZ_BUILD_DIR}/src/include/httpc"
  108. "$ENV{XYZ_BUILD_DIR}/src/include/ehttpd"
  109. "$ENV{XYZ_BUILD_DIR}/src/include/schedtasks"
  110. "$ENV{ACXYZ_SIG_DIR}/src/include/ZzEATXYZ"
  111. "$ENV{I18N_BUILD_DIR}/src/include/common"
  112. add_definitions(-DWIN32 -D_MBCS -DWINNT -D_MBCS
  113. -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE
  114. -DNO_DBLAYER -DNO_GUI
  115. -DPRODUCT_MAJOR_VERSION=${VERSION_MAJOR}
  116. -DPRODUCT_MINOR_VERSION=${VERSION_MINOR}
  117. -DPRODUCT_MAINTPACK_VERSION=${VERSION_PATCH}
  118. -DPRODUCT_POINTPATCH_VERSION=${VERSION_HOTFIX}
  119. -DPKGINFO_BUILD_DATE=$ENV{PKGINFO_BUILD_DATE}
  120. -DPKGINFO_VERSION=\"$ENV{PKGINFO_VERSION}\"
  121. -DPKGINFO_PSTAMP=\"$ENV{PKGINFO_PSTAMP}\")
  122. endif(WIN32)
  123. endif(UNIX)
  124.  
  125. add_subdirectory(lib)
  126. add_subdirectory(cmd)
clone this paste RAW Paste Data