project(kfouleggs)

add_subdirectory( pics ) 

include_directories( ${CMAKE_SOURCE_DIR}/libksirtet ${CMAKE_SOURCE_DIR}/libksirtet/base ${CMAKE_SOURCE_DIR}/libkdegames ${CMAKE_SOURCE_DIR}/libkdegames/highscore ${CMAKE_CURRENT_BINARY_DIR}/../libksirtet  )

if(KDE4_ENABLE_FPIE)
    set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KDE4_CXX_FPIE_FLAGS}")
endif(KDE4_ENABLE_FPIE)
########### next target ###############

set(kfouleggs_SRCS 
   piece.cpp 
   board.cpp 
   ai.cpp 
   field.cpp 
   main.cpp )

kde4_automoc(${kfouleggs_SRCS})

kde4_add_kcfg_files(kfouleggs_SRCS prefs.kcfgc )

kde4_add_executable(kfouleggs ${kfouleggs_SRCS})

if(KDE4_ENABLE_FPIE)
    target_link_libraries(kfouleggs  ${KDE4_KDECORE_LIBS} ksirtetlib ${KDE4_KDE3SUPPORT_LIBS} ${KDE4_PIE_LDFLAGS})
else(KDE4_ENABLE_FPIE)
    target_link_libraries(kfouleggs  ${KDE4_KDECORE_LIBS} ksirtetlib ${KDE4_KDE3SUPPORT_LIBS} )
endif(KDE4_ENABLE_FPIE)

install(TARGETS kfouleggs  DESTINATION ${BIN_INSTALL_DIR} )


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

install( FILES kfouleggs.desktop  DESTINATION  ${XDG_APPS_DIR} )
install( FILES kfouleggs.kcfg  DESTINATION  ${KCFG_INSTALL_DIR} )
install( FILES kfouleggs.notifyrc  DESTINATION  ${DATA_INSTALL_DIR}/kfouleggs )
install( FILES kfouleggsui.rc  DESTINATION  ${DATA_INSTALL_DIR}/kfouleggs )


#install-data-local:
#	@(test x$(HIGHSCORE_DIRECTORY) != x \
#	&& echo "********************************************************" \
#	&& echo "" \
#	&& echo "This game is installed sgid \"games\" to use the" \
#	&& echo "system-wide highscore file (in "$(HIGHSCORE_DIRECTORY)")." \
#	&& echo "" \
#	&& echo "If the system-wide highscore file does not exist, it is" \
#        && echo "created with the correct ownership and permissions. See the" \
#        && echo "INSTALL file in \"kdegames/libkdegames/highscore\" for details." \
#	&& echo "" \
#	&& echo "********************************************************" \
#	) || true
#
#install-exec-hook:
#	@(test x$(HIGHSCORE_DIRECTORY) != x \
#        && ((chown $(highscore_user):$(highscore_group) $(DESTBIN)) \
#	|| echo "Error: Could not install the game with correct permissions !!" \
#	)) || true
#
#	@(test x$(HIGHSCORE_DIRECTORY) != x \
#		&& ((mkdir -p $(DESTHIGHSCORES) && chown $(highscore_user):$(highscore_group) $(DESTHIGHSCORES) \
#		&& chmod 750 $(DESTHIGHSCORES)) \
#	|| echo "Error: Could not create the highscore directory with correct permissions !!" \
#	)) || true
#
#	@(test x$(HIGHSCORE_DIRECTORY) != x \
#        && ((chown $(highscore_user):$(highscore_group) $(DESTBIN)) \
#	|| echo "Error: Could not install the game with correct permissions !!" \
#	)) || true
#
#	@(test ${setgid} = true \
#        && ((chmod 2755  $(DESTBIN)) \
#	|| echo "Error: Could not install the game with correct permissions !!" \
#	)) || true
#
#	@(test x$(HIGHSCORE_DIRECTORY) != x \
#        && ((touch $(DESTSCORES) && chown $(highscore_user):$(highscore_group) $(DESTSCORES) \
#	&& chmod 0660 $(DESTSCORES)) \
#	|| echo "Error: Could not create system-wide highscore file with correct permissions !!" \
#	)) || true
