diff --git a/CMakeLists.txt b/CMakeLists.txt index d900817103..f85d260a9d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -138,6 +138,15 @@ if(DEFINED BUILD_SHARED) endif() unset(BUILD_SHARED CACHE) +# ENABLE_DEBUG_FUNCTIONS ==> LIBCELLML_ENABLE_DEBUG_FUNCTIONS +set(_PARAM_ANNOTATION "Enable the debug functions in debug.(cpp|h).") +set(LIBCELLML_ENABLE_DEBUG_FUNCTIONS OFF CACHE BOOL ${_PARAM_ANNOTATION}) +if(DEFINED ENABLE_DEBUG_FUNCTIONS) + set(LIBCELLML_ENABLE_DEBUG_FUNCTIONS ${ENABLE_DEBUG_FUNCTIONS} CACHE BOOL ${_PARAM_ANNOTATION} FORCE) +endif() +unset(ENABLE_DEBUG_FUNCTIONS CACHE) +mark_as_advanced(LIBCELLML_ENABLE_DEBUG_FUNCTIONS) + # Uninstall target configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.in.cmake" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a9633cbf37..5dcd7ad6ce 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -47,7 +47,6 @@ configure_file( set(SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/component.cpp ${CMAKE_CURRENT_SOURCE_DIR}/componententity.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/debug.cpp ${CMAKE_CURRENT_SOURCE_DIR}/entity.cpp ${CMAKE_CURRENT_SOURCE_DIR}/error.cpp ${CMAKE_CURRENT_SOURCE_DIR}/generator.cpp @@ -107,7 +106,6 @@ set(MODULE_HEADER_FILES ) set(GIT_HEADER_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/debug.h ${CMAKE_CURRENT_SOURCE_DIR}/internaltypes.h ${CMAKE_CURRENT_SOURCE_DIR}/namespaces.h ${CMAKE_CURRENT_SOURCE_DIR}/utilities.h @@ -123,6 +121,11 @@ set(HEADER_FILES ${MATHML_CONFIG_H} ) +if (LIBCELLML_ENABLE_DEBUG_FUNCTIONS) + list(APPEND SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/debug.cpp) + list(APPEND HEADER_FILES ${CMAKE_CURRENT_SOURCE_DIR}/debug.h) +endif() + # Only does anything if configuration target is Visual Studio. group_source_to_dir_structure( ${SOURCE_FILES} diff --git a/src/debug.cpp b/src/debug.cpp index 5a217c2413..7218e58f9e 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -13,10 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ - -#ifdef ENABLE_HANDY_DEBUGGING_FUNCTIONS - -# include "debug.h" +#include "debug.h" namespace libcellml { @@ -48,5 +45,3 @@ void printEquivalenceMap(const EquivalenceMap &map) } } // namespace libcellml - -#endif /* ENABLE_HANDY_DEBUGGING_FUNCTIONS */