kde's cmake files/macros

Peter Kümmel syntheticpp at gmx.net
Thu Feb 9 17:31:29 CET 2006


Here are some ideas to the cmake files.

Peter

-- at the moment FindPCRE requires both libraries, PCREPOSIX and PCRE.
-- it should prefer PCREPOSIX as mentioned in kjs/regexp.h.

Index: cmake/modules/FindPCRE.cmake
===================================================================
--- cmake/modules/FindPCRE.cmake	(Revision 507308)
+++ cmake/modules/FindPCRE.cmake	(Arbeitskopie)
@@ -16,7 +16,17 @@
 /usr/local/lib
 )

-SET(PCRE_LIBRARY ${PCRE_PCRE_LIBRARY} ${PCRE_PCREPOSIX_LIBRARY})
+#perfer pcreposix (see kjs/regexp.h)
+IF(PCRE_PCREPOSIX_LIBRARY)
+   SET(PCRE_LIBRARY ${PCRE_PCREPOSIX_LIBRARY})
+   #don't ask for both
+   SET(PCRE_PCRE_LIBRARY)
+ELSE(PCRE_PCREPOSIX_LIBRARY)
+   SET(PCRE_LIBRARY ${PCRE_PCRE_LIBRARY})
+   #don't ask for both
+   SET(PCRE_PCREPOSIX_LIBRARY)
+ENDIF(PCRE_PCREPOSIX_LIBRARY)
+

 IF(PCRE_INCLUDE_DIR AND PCRE_LIBRARY)
    SET(PCRE_FOUND TRUE)





-- search at the default installation path for kdewin32

Index: cmake/modules/FindKDE4.cmake
===================================================================
--- cmake/modules/FindKDE4.cmake	(Revision 507308)
+++ cmake/modules/FindKDE4.cmake	(Arbeitskopie)
@@ -180,8 +180,10 @@


    # at first find the kdewin32 library, this has to be compiled and installed before kdelibs/
-   FIND_LIBRARY(KDEWIN32_LIBRARY NAMES kdewin32 PATHS )
-   FIND_PATH(KDEWIN32_INCLUDE_DIR winposix_export.h )
+   FIND_LIBRARY(KDEWIN32_LIBRARY NAMES kdewin32 PATHS
+      $ENV{ProgramFiles}/kdewin32/lib )
+   FIND_PATH(KDEWIN32_INCLUDE_DIR winposix_export.h PATHS
+      $ENV{ProgramFiles}/kdewin32/include )

    # kdelibs/win/ has to be built before the rest of kdelibs/
    # eventually it will be moved out from kdelibs/




-- including of pcre.h fails because there is no HAVE_PCREPOSIX
-- add dependency to the *.lut.h, otherwise msvc will not generate them

Index: kjs/CMakeLists.txt
===================================================================
--- kjs/CMakeLists.txt	(Revision 507308)
+++ kjs/CMakeLists.txt	(Arbeitskopie)
@@ -8,11 +8,12 @@
 macro_optional_find_package(PCRE)
 if(PCRE_FOUND)
    include_directories(${PCRE_INCLUDE_DIR})
+   check_include_files(pcre.h HAVE_PCREPOSIX)
 else(PCRE_FOUND)

@@ -28,6 +29,8 @@
       COMMAND ${PERL_EXECUTABLE}
       ARGS ${CREATE_HASH_TABLE} ${CMAKE_CURRENT_SOURCE_DIR}/${_in_FILE} -i > ${CMAKE_CURRENT_BINARY_DIR}/${_out_FILE}
       DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_in_FILE} )
+   MACRO_ADD_FILE_DEPENDENCIES(${_dep_FILE} ${CMAKE_CURRENT_BINARY_DIR}/${_out_FILE})
 endmacro(CREATE_LUT)

 create_lut(date_object.cpp date_object.lut.h date_object.cpp)





-- this is just a hint to make the  "kde4_add_ui_files" macro work with msvc
-- the *ui.h files are only generated  if a other file is dependent on


Index: kdeui/CMakeLists.txt
===================================================================
--- kdeui/CMakeLists.txt	(Revision 507308)
+++ kdeui/CMakeLists.txt	(Arbeitskopie)
@@ -136,6 +136,8 @@
 kspellui.ui
 )

+MACRO_ADD_FILE_DEPENDENCIES(kspelldlg.cpp  ${CMAKE_CURRENT_BINARY_DIR}/kspellui.h)
+
 kde4_add_ui_files(kdeui_LIB_SRCS ${kdeui_UI} )

 set( kdeui_UI3


More information about the Kde-buildsystem mailing list