diff -r d4484a8ed66b -r 4bf7ef2fea2e CMakeLists.txt --- a/CMakeLists.txt Thu Jul 28 02:48:21 2011 +0300 +++ b/CMakeLists.txt Fri Aug 19 01:42:20 2011 +0300 @@ -41,7 +41,7 @@ set(CMAKE_REQUIRED_FLAGS ${LM_LDFLAGS} ${LM_CFLAGS}) check_function_exists(lm_connection_get_keep_alive_rate HAVE_LM_CONNECTION_GET_KEEP_ALIVE_RATE) check_function_exists(lm_connection_unregister_reply_handler HAVE_LM_CONNECTION_UNREGISTER_REPLY_HANDLER) -find_package(Perl) +find_program(DOCGEN_EXECUTABLE NAMES docgen.pl docgen DOC "Docgen documentation generator script (optional)") # (this should be before targets definitions) link_directories(${LUA_LIBRARY_DIRS} ${GLIB_LIBRARY_DIRS} ${LM_LIBRARY_DIRS}) @@ -62,8 +62,8 @@ COMPILE_FLAGS "-Wall ${DEBUG_COMPILE_FLAGS}") ## Extra targets -if(PERL_FOUND) - add_custom_command(OUTPUT ${lua-lm_BINARY_DIR}/loudmouth.html COMMAND ${PERL_EXECUTABLE} ${lua-lm_SOURCE_DIR}/docgen.pl -f html -t "Lua-loudmouth API reference" -o ${lua-lm_BINARY_DIR}/loudmouth.html -- ${loudmouth_SOURCES} DEPENDS ${lua-lm_SOURCE_DIR}/docgen.pl ${loudmouth_SOURCES} WORKING_DIRECTORY ${lua-lm_SOURCE_DIR}) +if(DOCGEN_EXECUTABLE) + add_custom_command(OUTPUT ${lua-lm_BINARY_DIR}/loudmouth.html COMMAND ${DOCGEN_EXECUTABLE} -f html -t "Lua-loudmouth API reference" -o ${lua-lm_BINARY_DIR}/loudmouth.html -- ${loudmouth_SOURCES} DEPENDS ${DOCGEN_EXECUTABLE} ${loudmouth_SOURCES} WORKING_DIRECTORY ${lua-lm_SOURCE_DIR}) add_custom_target(doc ALL DEPENDS ${lua-lm_BINARY_DIR}/loudmouth.html) endif() if(LUA_EXECUTABLE) @@ -101,7 +101,7 @@ install(TARGETS loudmouth DESTINATION lib/lua/5.1) install(FILES lm.lua DESTINATION share/lua/5.1) install(FILES test.lua DESTINATION share/doc/${CPACK_PACKAGE_NAME}/examples) -if(PERL_FOUND) +if(DOCGEN_EXECUTABLE) install(FILES ${lua-lm_BINARY_DIR}/loudmouth.html DESTINATION share/doc/${CPACK_PACKAGE_NAME}) endif() install(FILES README TODO COPYING DESTINATION share/doc/${CPACK_PACKAGE_NAME})