Skip to content

Commit

Permalink
Fix ctags detection and cookbook target
Browse files Browse the repository at this point in the history
  • Loading branch information
vigsterkr committed Mar 10, 2016
1 parent a898417 commit 8cf2301
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Expand Up @@ -304,6 +304,7 @@ STRING(REGEX REPLACE "[0-9]*.[0-9]*.([0-9]*)" "\\1" SHOGUN_VERSION_PATCH "${VERS
SET(BUILD_STATIC "Build a statically linked binary" OFF)
################# EXAMPLES ##################
OPTION(BUILD_EXAMPLES "Build Examples" ON)
OPTION(BUILD_META_EXAMPLES "Generate API examples from meta-examples" ON)
# note the examples dir is added below after tests have been defined

################# DATATYPES #################
Expand Down Expand Up @@ -662,7 +663,6 @@ ENDIF()
FIND_PACKAGE(PythonInterp REQUIRED)

# Meta examples and dependencies
OPTION(BUILD_META_EXAMPLES "Generate API examples from meta-examples" ON)
IF(BUILD_META_EXAMPLES)
include(FindPythonModule)
find_python_module(ply REQUIRED)
Expand Down Expand Up @@ -1107,7 +1107,7 @@ ENDIF()

IF(EXISTS ${CMAKE_SOURCE_DIR}/examples)
IF(ENABLE_TESTING AND NOT BUILD_EXAMPLES)
message("Tests require (disabled) examples, enabling.")
message(STATUS "Tests require (disabled) examples, enabling.")
ENDIF()
IF(ENABLE_TESTING OR BUILD_EXAMPLES)
add_subdirectory(${CMAKE_SOURCE_DIR}/examples)
Expand Down
23 changes: 17 additions & 6 deletions cmake/FindCtags.cmake
Expand Up @@ -12,7 +12,6 @@ find_program( CTAGS_EXECUTABLE
NAMES ctags
DOC "ctags executable"
)
mark_as_advanced( CTAGS_EXECUTABLE )

if( CTAGS_EXECUTABLE )
execute_process(COMMAND ${CTAGS_EXECUTABLE} --version
Expand All @@ -21,12 +20,24 @@ if( CTAGS_EXECUTABLE )
OUTPUT_STRIP_TRAILING_WHITESPACE
)

if( ctags_version MATCHES "^Exuberant Ctags [0-9]" )
string( REPLACE "Exuberant Ctags " "" CTAGS_VERSION_STRING "${ctags_version}" )
string( REGEX REPLACE ",.*$" "" CTAGS_VERSION_STRING ${CTAGS_VERSION_STRING} )
endif()
if (ctags_version STREQUAL "")
unset(CTAGS_EXECUTABLE CACHE)
MESSAGE(STATUS "The ctags found is not suitable for meta examples.")
else()
string(TOLOWER ${ctags_version} ctags_version)
if(NOT ctags_version MATCHES exuberant)
set(CTAGS_FLAVOR "GNU")
else()
set(CTAGS_FLAVOR "Exuberant")
string( REPLACE "Exuberant Ctags " "" CTAGS_VERSION_STRING "${ctags_version}" )
string( REGEX REPLACE ",.*$" "" CTAGS_VERSION_STRING ${CTAGS_VERSION_STRING} )
endif()
set(CTAGS_FLAVOR ${CTAGS_FLAVOR} CACHE STRING "Ctags executable flavour" FORCE)
message(STATUS "Ctags flavour: ${CTAGS_FLAVOR}")

unset( ctags_version )
unset( ctags_version )
mark_as_advanced( CTAGS_EXECUTABLE )
endif()
endif()

# Handle the QUIETLY and REQUIRED arguments and set CTAGS_FOUND to TRUE if
Expand Down
2 changes: 1 addition & 1 deletion doc/cookbook/CMakeLists.txt
Expand Up @@ -45,7 +45,7 @@ add_custom_target(cookbook_sphinx_linkcheck
DEPENDS cookbook_sphinx_extensions cookbook_sphinx_templates
cookbook_sphinx_static meta_examples)

add_custom_target(cookbook doc
add_custom_target(cookbook
${SPHINX_EXECUTABLE}
-q -b html
-c "${BINARY_BUILD_DIR}"
Expand Down

0 comments on commit 8cf2301

Please sign in to comment.