diff options
author | John Wiegley <johnw@newartisans.com> | 2014-09-11 12:58:51 +0100 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2014-09-11 12:58:51 +0100 |
commit | 8fc83e8148479d0ce873c279759273e100ba5fb6 (patch) | |
tree | a69c44ccb77b97590f11722537f467299674d729 | |
parent | 03bace82bd02dc2b15e1b9ae94c0238ff728037d (diff) | |
parent | d9d4876755efd97fdd7c7ce7552e7c6ee339a94c (diff) | |
download | fork-ledger-8fc83e8148479d0ce873c279759273e100ba5fb6.tar.gz fork-ledger-8fc83e8148479d0ce873c279759273e100ba5fb6.tar.bz2 fork-ledger-8fc83e8148479d0ce873c279759273e100ba5fb6.zip |
Merge pull request #321 from kljohann/cmake
Clean up CMake files
-rwxr-xr-x | acprep | 3 | ||||
-rw-r--r-- | doc/CMakeLists.txt | 67 | ||||
-rw-r--r-- | test/CMakeLists.txt | 14 |
3 files changed, 35 insertions, 49 deletions
@@ -815,9 +815,6 @@ class PrepareBuild(CommandLineApp): if self.options.boost_include: conf_args.append('-DBOOST_INCLUDEDIR=%s' % self.options.boost_include) - if self.options.build_dir: - conf_args.append('-DBUILD_DIR=%s' % - self.options.build_dir) if self.prefix_directory(): conf_args.append('-DCMAKE_INSTALL_PREFIX=%s' % self.prefix_directory()) diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 9bf1bffe..96c6d518 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -27,27 +27,29 @@ endif() ######################################################################## -if (NOT BUILD_DOCS) - add_custom_target(doc DEPENDS doc.doxygen) - return() -endif() +if (BUILD_DOCS) + find_program(MAKEINFO makeinfo) + find_program(TEXI2PDF texi2pdf) + find_program(TEX tex) + find_program(MAN2HTML man2html) + find_program(GROFF groff) + set(ledger_info_files ledger3.texi ledger-mode.texi) -set(info_files ledger3.texi ledger-mode.texi) + if (NOT MAKEINFO) + message(WARNING "Could not find makeinfo. Info version of documentation cannot be built.") + endif() -find_program(MAKEINFO makeinfo) -find_program(TEXI2PDF texi2pdf) -find_program(TEX tex) -find_program(MAN2HTML man2html) -find_program(GROFF groff) + if (NOT TEXI2PDF OR NOT TEX) + message(WARNING "Could not find texi2pdf or tex. PDF version of documentation will not be built.") + endif() +endif() ######################################################################## -foreach(file ${info_files}) +foreach(file ${ledger_info_files}) get_filename_component(file_base ${file} NAME_WE) - if (NOT MAKEINFO) - message(WARNING "Could not find makeinfo. Info version of documentation cannot be built.") - else() + if (MAKEINFO) add_custom_command(OUTPUT ${file_base}.info COMMAND makeinfo --force --no-split -o ${file_base}.info ${CMAKE_CURRENT_SOURCE_DIR}/${file} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${file} @@ -55,20 +57,15 @@ foreach(file ${info_files}) list(APPEND ledger_doc_files ${file_base}.info) endif() - if (BUILD_WEB_DOCS) - if (NOT MAKEINFO) - message(WARNING "Could not find makeinfo. HTML version of documentation cannot be built.") - endif() + if (BUILD_WEB_DOCS AND MAKEINFO) add_custom_command(OUTPUT ${file_base}.html COMMAND makeinfo --force --html --no-split -o ${file_base}.html ${CMAKE_CURRENT_SOURCE_DIR}/${file} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${file} VERBATIM) list(APPEND ledger_doc_files ${file_base}.html) - endif(BUILD_WEB_DOCS) + endif() - if (NOT TEXI2PDF OR NOT TEX) - message(WARNING "Could not find texi2pdf or tex. PDF version of documentation will not be built.") - else() + if (TEXI2PDF AND TEX) if (BUILD_A4_PDF) set(papersize --texinfo=@afourpaper) endif() @@ -117,22 +114,16 @@ if (CMAKE_INSTALL_MANDIR) DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 COMPONENT doc) endif(CMAKE_INSTALL_MANDIR) -foreach(file ${info_files}) - get_filename_component(file_base ${file} NAME_WE) +foreach(file ${ledger_doc_files}) + get_filename_component(file_ext ${file} EXT) - if (CMAKE_SOURCE_DIR STREQUAL BUILD_DIR) - set(doc_dir ${CMAKE_CURRENT_SOURCE_DIR}) - else() - get_filename_component(dir_base ${CMAKE_CURRENT_SOURCE_DIR} NAME_WE) - set(doc_dir "${CMAKE_SOURCE_DIR}/${BUILD_DIR}/${dir_base}") - endif() - - install(FILES ${doc_dir}/${file_base}.info - DESTINATION ${CMAKE_INSTALL_INFODIR} COMPONENT doc) - install(FILES ${doc_dir}/${file_base}.pdf - DESTINATION ${CMAKE_INSTALL_DOCDIR} COMPONENT doc OPTIONAL) - if (BUILD_WEB_DOCS) - install(FILES ${doc_dir}/${file_base}.html + if(file_ext STREQUAL ".info") + if(CMAKE_INSTALL_INFODIR) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${file} + DESTINATION ${CMAKE_INSTALL_INFODIR} COMPONENT doc) + endif() + elseif(CMAKE_INSTALL_DOCDIR) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${file} DESTINATION ${CMAKE_INSTALL_DOCDIR} COMPONENT doc) - endif(BUILD_WEB_DOCS) + endif() endforeach() diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 0f19ae6f..21d27c7d 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -6,8 +6,6 @@ if (NOT PROCESSORS EQUAL 0) set(CTEST_BUILD_FLAGS -j${JOBS}) endif() -get_target_property(LEDGER_LOCATION ledger LOCATION) - add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} ${CTEST_BUILD_FLAGS}) add_subdirectory(unit) @@ -23,9 +21,9 @@ macro(add_ledger_harness_tests _class) get_filename_component(TestFile_Name ${TestFile} NAME_WE) string(FIND ${TestFile_Name} "_py" TestFile_IsPythonTest) if ((TestFile_IsPythonTest EQUAL -1) OR HAVE_BOOST_PYTHON) - add_test(${_class}Test_${TestFile_Name} - ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/test/RegressTests.py - ${LEDGER_LOCATION} ${PROJECT_SOURCE_DIR} + add_test(NAME ${_class}Test_${TestFile_Name} + COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/test/RegressTests.py + $<TARGET_FILE:ledger> ${PROJECT_SOURCE_DIR} ${TestFile} ${TEST_PYTHON_FLAGS}) set_target_properties(check PROPERTIES DEPENDS ${_class}Test_${TestFile_Name}) @@ -44,9 +42,9 @@ add_subdirectory(regress) # file(GLOB ${_class}_TESTS ${PROJECT_SOURCE_DIR}/doc/*.texi) # foreach(TestFile ${${_class}_TESTS}) # get_filename_component(TestFile_Name ${TestFile} NAME_WE) -# add_test(${_class}Test_${TestFile_Name} -# ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/test/DocTests.py -# --ledger ${LEDGER_LOCATION} --file ${TestFile}) +# add_test(NAME ${_class}Test_${TestFile_Name} +# COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/test/DocTests.py +# --ledger $<TARGET_FILE:ledger> --file ${TestFile}) # set_target_properties(check PROPERTIES DEPENDS ${_class}Test_${TestFile_Name}) # endforeach() #endif() |