Skip to content

Commit

Permalink
Fix compilation when used as submodule
Browse files Browse the repository at this point in the history
There were problems due to the use of GenerateExportHeader when using
this as git submodule. This has been fixed. Be sure to add
EXT_INCLUDE in parent project to include_directories.

Signed-off-by: Christian Rapp <[email protected]>
  • Loading branch information
crapp committed Nov 13, 2015
1 parent 1002f07 commit b3fe56d
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 13 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ add_subdirectory(test)
add_subdirectory(include/qAccordion)
add_subdirectory(src)

# use ext_include in parent projects with include directrories. makes sure the generated headers are found
if (QACCORDION_EXTERNAL)
set (EXT_INCLUDE ${EXTERNAL_INCLUDE} PARENT_SCOPE)
endif(QACCORDION_EXTERNAL)
4 changes: 2 additions & 2 deletions include/qAccordion/clickableframe.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
#include <QLabel>
#include <QGraphicsView>

#include "config.h"
#include "qaccordion_export.h"
#include <qaccordion_config.h>
#include <qaccordion_export.h>

// TODO: No need to use a namespace for our constants as we are using them only
// in this class
Expand Down
6 changes: 3 additions & 3 deletions include/qAccordion/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

#ifndef CONFIG_H_IN
#define CONFIG_H_IN
#ifndef QACCORDION_CONFIG_H_IN
#define QACCORDION_CONFIG_H_IN

#define VERSION_MAJOR "@qAccordion_VERSION_MAJOR@"
#define VERSION_MINOR "@qAccordion_VERSION_MINOR@"
Expand All @@ -27,4 +27,4 @@
#define ATTR_UNUSED
#endif

#endif // CONFIG_H_IN
#endif // QACCORDION_CONFIG_H_IN
4 changes: 2 additions & 2 deletions include/qAccordion/contentpane.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@

#include <memory>

#include "config.h"
#include "qaccordion_export.h"
#include <qaccordion_config.h>
#include <qaccordion_export.h>
#include "clickableframe.h"
#include "qaccordion.h"

Expand Down
4 changes: 2 additions & 2 deletions include/qAccordion/qaccordion.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
#include <algorithm>
#include <iterator>

#include "config.h"
#include "qaccordion_export.h"
#include <qaccordion_config.h>
#include <qaccordion_export.h>
#include "contentpane.h"

class ContentPane;
Expand Down
15 changes: 11 additions & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ elseif(WIN32)
endif (${MSVC_VERSION} LESS 1800)
else ()
message(FATAL_ERROR "Your C++ compiler does not support C++11.")
endif (WIN32)
endif ()

# include GenerateExportHeader module
include(GenerateExportHeader)
Expand All @@ -57,20 +57,26 @@ message(STATUS "Found Qt version ${Qt5Widgets_VERSION_STRING}")

if (QACCORDION_EXTERNAL)
set(base_path ${CMAKE_SOURCE_DIR}/external/qaccordion/)
message(STATUS "Using qAccordion external config with base path: ${base_path}")
# provide the current build path to parent scope. add this to include directories in parent projects
set(EXTERNAL_INCLUDE
"${CMAKE_CURRENT_BINARY_DIR}"
PARENT_SCOPE
)
else ()
set(base_path ${CMAKE_SOURCE_DIR})
endif(QACCORDION_EXTERNAL)

include_directories(
${PROJECT_BINARY_DIR} # include this directory so all moc headers and wrapped ui files are found
${CMAKE_CURRENT_BINARY_DIR}
${base_path}/include
)

# configure a header file to pass some of the CMake settings
# to the source code
configure_file (
${base_path}/include/qAccordion/config.h.in
${CMAKE_CURRENT_BINARY_DIR}/config.h
${CMAKE_CURRENT_BINARY_DIR}/qaccordion_config.h
)

set (QACCORDION_SOURCE
Expand Down Expand Up @@ -102,5 +108,6 @@ install(TARGETS qAccordion DESTINATION lib)
install(FILES ${base_path}/include/qAccordion/clickableframe.h DESTINATION include/qAccordion)
install(FILES ${base_path}/include/qAccordion/contentpane.h DESTINATION include/qAccordion)
install(FILES ${base_path}/include/qAccordion/qaccordion.h DESTINATION include/qAccordion)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/config.h DESTINATION include/qAccordion)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/qaccordion_config.h DESTINATION include/qAccordion)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/qaccordion_export.h DESTINATION include/qAccordion)

0 comments on commit b3fe56d

Please sign in to comment.