Mercurial > projects > qtd
comparison CMakeLists.txt @ 237:62d0dce52dac
CMake: improvements && fixes
author | SokoL_SD |
---|---|
date | Mon, 20 Jul 2009 06:00:55 +0000 |
parents | b796329e8c38 |
children | 4716eaf4a67e |
comparison
equal
deleted
inserted
replaced
236:fcc0ada121e1 | 237:62d0dce52dac |
---|---|
1 cmake_minimum_required(VERSION 2.6) | 1 cmake_minimum_required(VERSION 2.6) |
2 PROJECT(qtd CXX C) | 2 PROJECT(qtd CXX C) |
3 | 3 |
4 ########################################################## | 4 ########################################################## |
5 ## Building generator and settings. | 5 ## Building generator && settings. |
6 ########################################################## | 6 ########################################################## |
7 if(NOT SECOND_RUN) | 7 if(NOT SECOND_RUN) |
8 | 8 |
9 FIND_PACKAGE(Qt4 REQUIRED) | 9 FIND_PACKAGE(Qt4 REQUIRED) |
10 set (QT_USE_QTMAIN false) | 10 set (QT_USE_QTMAIN false) |
58 endif (${CMAKE_BUILD_TYPE} MATCHES [dD][eE][bB][uU][gG]) | 58 endif (${CMAKE_BUILD_TYPE} MATCHES [dD][eE][bB][uU][gG]) |
59 if (${CMAKE_BUILD_TYPE} MATCHES [rR][eE][lL][eE][aA][sS]) | 59 if (${CMAKE_BUILD_TYPE} MATCHES [rR][eE][lL][eE][aA][sS]) |
60 #add_definitions(-UNO_DEBUG) | 60 #add_definitions(-UNO_DEBUG) |
61 endif(${CMAKE_BUILD_TYPE} MATCHES [rR][eE][lL][eE][aA][sS] ) | 61 endif(${CMAKE_BUILD_TYPE} MATCHES [rR][eE][lL][eE][aA][sS] ) |
62 | 62 |
63 # System specifc settings. | 63 # System specific settings. |
64 if(CMAKE_HOST_WIN32) | 64 if(CMAKE_HOST_WIN32) |
65 set(implib implib) | 65 set(implib implib) |
66 find_program(IMPLIB ${implib}) | 66 find_program(IMPLIB ${implib}) |
67 if (NOT IMPLIB) | 67 if (NOT IMPLIB) |
68 message(FATAL_ERROR "implib not found. You can donwload it from http://ftp.digitalmars.com/bup.zip") | 68 message(FATAL_ERROR "implib not found. You can donwload it from http://ftp.digitalmars.com/bup.zip") |
100 | 100 |
101 set(cd_path ${CMAKE_BINARY_DIR}/build) | 101 set(cd_path ${CMAKE_BINARY_DIR}/build) |
102 make_native_path(cd_path) | 102 make_native_path(cd_path) |
103 add_custom_command(TARGET main POST_BUILD | 103 add_custom_command(TARGET main POST_BUILD |
104 COMMAND ${CMAKE_COMMAND} ARGS -E make_directory ${CMAKE_BINARY_DIR}/build | 104 COMMAND ${CMAKE_COMMAND} ARGS -E make_directory ${CMAKE_BINARY_DIR}/build |
105 COMMAND cd ARGS ${cd_path} && ${CMAKE_COMMAND} -G${CMAKE_GENERATOR} -DSECOND_RUN=1 ${CMAKE_SOURCE_DIR} && ${make_util} allpackages | 105 COMMAND cd ARGS ${cd_path} && ${CMAKE_COMMAND} -G${CMAKE_GENERATOR} -DSECOND_RUN=1 ${CMAKE_SOURCE_DIR} && ${make_util} |
106 COMMENT "" | 106 COMMENT "" |
107 ) | 107 ) |
108 | 108 |
109 ## Make commands. | 109 ## Make commands. |
110 set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${CMAKE_BINARY_DIR}/build) | 110 set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${CMAKE_BINARY_DIR}/build) |
180 ##-------------------------------------------- | 180 ##-------------------------------------------- |
181 ## Macros and functions. | 181 ## Macros and functions. |
182 ##-------------------------------------------- | 182 ##-------------------------------------------- |
183 | 183 |
184 macro(load_generated_classes ) | 184 macro(load_generated_classes ) |
185 include(cpp/qt_${package}/qt_${package}.txt) | 185 include(${CMAKE_BINARY_DIR}/cpp/qt_${package}/qt_${package}.txt) |
186 endmacro(load_generated_classes ) | 186 endmacro(load_generated_classes ) |
187 | 187 |
188 macro(qtd_add_resource output) | 188 macro(qtd_add_resource output) |
189 set (params NAME OPTIONS) | 189 set (params NAME OPTIONS) |
190 qtd_parse_params (RESOURCES params ${ARGN}) | 190 qtd_parse_params (RESOURCES params ${ARGN}) |
301 LIB_PATHS ${QTD_LIBRARIES_PATH} ${CMAKE_SOURCE_DIR}/lib LIBS ${qtd_libs}) | 301 LIB_PATHS ${QTD_LIBRARIES_PATH} ${CMAKE_SOURCE_DIR}/lib LIBS ${qtd_libs}) |
302 ## TODO: Enable. | 302 ## TODO: Enable. |
303 #if(STRIP AND ${CMAKE_BUILD_TYPE} EQUAL "Release" AND CMAKE_HOST_UNIX) ## | 303 #if(STRIP AND ${CMAKE_BUILD_TYPE} EQUAL "Release" AND CMAKE_HOST_UNIX) ## |
304 # add_custom_command(TARGET example_${name} POST_BUILD COMMAND "${STRIP}" ARGS "${output}") | 304 # add_custom_command(TARGET example_${name} POST_BUILD COMMAND "${STRIP}" ARGS "${output}") |
305 #endif(STRIP AND ${CMAKE_BUILD_TYPE} EQUAL "Release" AND CMAKE_HOST_UNIX) | 305 #endif(STRIP AND ${CMAKE_BUILD_TYPE} EQUAL "Release" AND CMAKE_HOST_UNIX) |
306 add_dependencies(${name} allpackages) | 306 add_dependencies(examples ${name}) |
307 add_dependencies(${name} allpackages tools) | |
307 endmacro(build_example sources) | 308 endmacro(build_example sources) |
308 | 309 |
309 ##-------------------------------------------- | 310 ##-------------------------------------------- |
310 ## Build and install library. | 311 ## Build and install library. |
311 ##-------------------------------------------- | 312 ##-------------------------------------------- |
527 endforeach(package_big ${packages_big}) | 528 endforeach(package_big ${packages_big}) |
528 if(GENERATE_DI_FILES) | 529 if(GENERATE_DI_FILES) |
529 add_custom_target(generate_headers ALL DEPENDS ${interfaces_list}) | 530 add_custom_target(generate_headers ALL DEPENDS ${interfaces_list}) |
530 endif(GENERATE_DI_FILES) | 531 endif(GENERATE_DI_FILES) |
531 | 532 |
532 | |
533 set(CPACK_COMPONENTS_ALL qtd qtd_tools) | 533 set(CPACK_COMPONENTS_ALL qtd qtd_tools) |
534 | 534 |
535 ##-------------------------------------------- | 535 ##-------------------------------------------- |
536 ## Build other parts of the QtD. | 536 ## Build other parts of the QtD. |
537 ##-------------------------------------------- | 537 ##-------------------------------------------- |
538 add_custom_target(tools ALL) | 538 |
539 if(BUILD_TOOLS) | 539 if(BUILD_TOOLS) |
540 add_custom_target(tools ALL) | |
540 add_subdirectory(tools) | 541 add_subdirectory(tools) |
541 add_dependencies(tools drcc duic) | 542 add_dependencies(tools drcc duic) |
542 endif(BUILD_TOOLS) | 543 endif(BUILD_TOOLS) |
543 | 544 |
544 if(BUILD_EXAMPLES) | 545 if(BUILD_EXAMPLES) |
546 add_custom_target(examples ALL) | |
547 add_dependencies(examples allpackages tools) | |
545 add_subdirectory(demos) | 548 add_subdirectory(demos) |
546 add_subdirectory(examples) | 549 add_subdirectory(examples) |
547 endif(BUILD_EXAMPLES) | 550 endif(BUILD_EXAMPLES) |
548 | 551 |
549 #execute_process(COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_BINARY_DIR}/CMakeCache.txt) | 552 #execute_process(COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_BINARY_DIR}/CMakeCache.txt) |