FIND_PACKAGE(KDE3 REQUIRED)

SET(CMAKE_VERBOSE_MAKEFILE ON)

ADD_DEFINITIONS(${QT_DEFINITIONS} ${KDE3_DEFINITIONS})

LINK_DIRECTORIES(${KDE3_LIB_DIR})

INCLUDE_DIRECTORIES( ${KDE3_INCLUDE_DIR} ${QT_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}  )

#configure checks, added manually

INCLUDE(CheckIncludeFiles) # module for testing for headers coming with cmake

CHECK_INCLUDE_FILES( unistd.h HAVE_UNISTD_H)
CHECK_INCLUDE_FILES( string.h HAVE_STRING_H)

CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/config.h.cmake ${CMAKE_BINARY_DIR}/config.h)

########### next target ###############

SET(kio_man_test_SRCS
kio_man_test.cpp
)

KDE3_AUTOMOC(${kio_man_test_SRCS})

IF(KDE3_BUILD_TESTS)
KDE3_ADD_EXECUTABLE(kio_man_test ${kio_man_test_SRCS})

TARGET_LINK_LIBRARIES(kio_man_test  ${QT_AND_KDECORE_LIBS} )

ENDIF(KDE3_BUILD_TESTS)

########### next target ###############

SET(man2html_SRCS
dummy.cpp
)

KDE3_AUTOMOC(${man2html_SRCS})

FILE(WRITE dummy.cpp "//autogenerated file by cmake\n")
IF(KDE3_BUILD_TESTS)
KDE3_ADD_EXECUTABLE(man2html ${man2html_SRCS})

TARGET_LINK_LIBRARIES(man2html  ${QT_AND_KDECORE_LIBS} )

ENDIF(KDE3_BUILD_TESTS)

########### next target ###############

SET(kio_man_PART_SRCS
man2html.cpp
kio_man.cpp
)

KDE3_AUTOMOC(${kio_man_PART_SRCS})

KDE3_ADD_KPART(kio_man ${kio_man_PART_SRCS})

TARGET_LINK_LIBRARIES(kio_man  ${QT_AND_KDECORE_LIBS} )

INSTALL_TARGETS(/lib/kde3 kio_man )


########### next target ###############

SET(kmanpart_PART_SRCS
kmanpart.cpp
)

KDE3_AUTOMOC(${kmanpart_PART_SRCS})

KDE3_ADD_KPART(kmanpart WITH_PREFIX ${kmanpart_PART_SRCS})

TARGET_LINK_LIBRARIES(kmanpart  ${QT_AND_KDECORE_LIBS} kparts )

INSTALL_TARGETS(/lib/kde3 kmanpart )


########### install files ###############

INSTALL_FILES( /share/apps/kio_man FILES kio_man.css )
INSTALL_FILES( /share/services FILES man.protocol kmanpart.desktop )




#original Makefile.am contents follow:

### Makefile.am of kdebase/kioslave/man
#
#INCLUDES= $(all_includes)
#AM_LDFLAGS = $(all_libraries) $(KDE_RPATH)
#
#EXTRA_PROGRAMS = kio_man_test man2html
#
######## just for testing (j.habenicht@europemail.com, 15.02.2001)
#
#kio_man_test_SOURCES = kio_man_test.cpp
#kio_man_test_LDFLAGS = $(all_libraries) $(KDE_RPATH)
#kio_man_test_LDADD = man2html.lo kio_man.lo $(LIB_KIO) $(LIB_KDEUI) $(LIB_KDECORE) $(LIB_QT)
#
######## Files
#
#kde_module_LTLIBRARIES = kio_man.la  libkmanpart.la
#
#kio_man_la_SOURCES = man2html.cpp kio_man.cpp
#kio_man_la_LIBADD = $(LIB_KSYCOCA)
#kio_man_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN)
#noinst_HEADERS = kio_man.h
#### TODO Why is man2htmk.h distributed?
#
#libkmanpart_la_SOURCES = kmanpart.cpp
#libkmanpart_la_LIBADD = -lkhtml $(LIB_KPARTS)
#libkmanpart_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
#
#kdelnk_DATA = man.protocol kmanpart.desktop
#kdelnkdir = $(kde_servicesdir)
#
#kio_man_data_DATA = kio_man.css
#kio_man_datadir = $(kde_datadir)/kio_man
#EXTRA_DIST=$(kio_man_data_DATA)
#
#METASOURCES = AUTO
#
#messages:
#	$(XGETTEXT) -C *.cpp *.h -o $(podir)/kio_man.pot
#
#man2html_SOURCES = dummy.cpp
#man2html_LDADD = man2html_simple.o $(LIB_QT)
#man2html_LDFLAGS = $(all_libraries) $(KDE_RPATH)
#
#dummy.cpp:
#	echo > $@
#
#man2html_simple.o: $(srcdir)/man2html.cpp
#	-rm -f man2html_simple.cpp
#	$(LN_S) $(srcdir)/man2html.cpp man2html_simple.cpp
#	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) -DSIMPLE_MAN2HTML $(INCLUDES) $(CPPFLAGS) $(CXXFLAGS) -c man2html_simple.cpp
#
