add_library(wrapper_example SHARED main.cpp test.cpp test.hpp test_2.hpp)
target_include_directories(wrapper_example PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

option(GENERATE_WRAPPING "Generate PyBind11 wrapping with Python?" OFF)
if (GENERATE_WRAPPING)
    add_subdirectory(pybind11)
    find_package (Python COMPONENTS Interpreter Development)
    include_directories(${Python_INCLUDE_DIRS})
    include_directories(${CMAKE_SOURCE_DIR})
    include_directories(${CMAKE_CURRENT_SOURCE_DIR})
    find_program(CastXML_EXECUTABLE NAMES castxml)

    option(DEFINE_TEST_PARAM "Adds a define parameter to swap definitions of the 'summer' function" OFF)
    if (DEFINE_TEST_PARAM)
      set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-DTESTFLAG")
     endif()

    message(\"${CMAKE_CXX_FLAGS}\")
    execute_process(COMMAND ${Python_EXECUTABLE} ${CMAKE_SOURCE_DIR}/generator.py "-s"  ${CMAKE_CURRENT_SOURCE_DIR}
                                                                                  "-g"  ${CastXML_EXECUTABLE}
                                                                                  "-cf" \"${CMAKE_CXX_FLAGS}\"
                                                                                  "-o"  ${CMAKE_CURRENT_SOURCE_DIR}
                    OUTPUT_VARIABLE generator_return)
    execute_process(COMMAND ${Python_EXECUTABLE} ${CMAKE_SOURCE_DIR}/generator.py "-s"  ${CMAKE_CURRENT_SOURCE_DIR}
                                                                                  "-g"  ${CastXML_EXECUTABLE}
                                                                                  "-cf" \"${CMAKE_CXX_FLAGS}\"
                                                                                  "-o"  ${CMAKE_CURRENT_SOURCE_DIR}
                                                                                  -n
                    OUTPUT_VARIABLE generator_return OUTPUT_STRIP_TRAILING_WHITESPACE)
    message(${generator_return})
    pybind11_add_module(wrapped_example main.cpp ${generator_return})

    target_link_libraries(wrapped_example PUBLIC wrapper_example)
    add_test(NAME WG_Linter COMMAND pycodestyle ${CMAKE_SOURCE_DIR}/generator.py WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
endif()