Skip to content

Commit

Permalink
Allow building against the system's Catch library.
Browse files Browse the repository at this point in the history
Bug: #201
Bug: #178
  • Loading branch information
cameronwhite committed Nov 28, 2015
1 parent 0b3361b commit 3b1c3fb
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -64,7 +64,7 @@ If you've already cloned the repository, you can run `git submodule init && git
* For older Ubuntu systems (such as Ubuntu 12.04) - you may need to [add some PPAs](https://github.com/powertab/powertabeditor/blob/master/.travis/setup_linux.sh) to get updated versions of the dependencies.
* Install dependencies:
* `sudo apt-get update`
* `sudo apt-get install cmake qtbase5-dev libboost-dev libboost-date-time-dev libboost-iostreams-dev libboost-program-options-dev libboost-regex-dev libasound2-dev libiberty-dev binutils-dev rapidjson-dev libpugixml-dev`
* `sudo apt-get install cmake qtbase5-dev libboost-dev libboost-date-time-dev libboost-iostreams-dev libboost-program-options-dev libboost-regex-dev libasound2-dev libiberty-dev binutils-dev rapidjson-dev libpugixml-dev, catch`
* `sudo apt-get install timidity` - timidity is not required for building, but is a good sequencer for MIDI playback.
* Optionally, use [Ninja](http://martine.github.io/ninja/) instead of `make` (`sudo apt-get install ninja-build`)
* Build:
Expand Down
13 changes: 12 additions & 1 deletion cmake/third_party/Catch.cmake
@@ -1,6 +1,17 @@
find_package( Catch )

if ( CATCH_FOUND )
set( _catch_dir ${Catch_INCLUDE_DIRS} )
else ()
set( _catch_dir ${PTE_EXTERNAL_DIR}/Catch/single_include )
message( STATUS "Using Catch library from ${_catch_dir}" )
endif ()

add_library( Catch INTERFACE IMPORTED )

set_target_properties(
Catch PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${PTE_EXTERNAL_DIR}/Catch/single_include
INTERFACE_INCLUDE_DIRECTORIES ${_catch_dir}
)

unset( _catch_dir )
8 changes: 8 additions & 0 deletions cmake/third_party/modules/FindCatch.cmake
@@ -0,0 +1,8 @@
include( FindPackageHandleStandardArgs )

find_path( CATCH_INCLUDE_DIR NAMES catch.hpp)
set( Catch_INCLUDE_DIRS ${CATCH_INCLUDE_DIR} )

find_package_handle_standard_args( Catch DEFAULT_MSG CATCH_INCLUDE_DIR )

mark_as_advanced( CATCH_INCLUDE_DIR )

0 comments on commit 3b1c3fb

Please sign in to comment.