Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Complete quoting for parameters of some CMake commands. #71

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
50 changes: 26 additions & 24 deletions CMakeLists.txt
Expand Up @@ -22,7 +22,7 @@ if(USE_QT5)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
else()
find_package(Qt4 COMPONENTS QtCore QtGui QtNetwork REQUIRED)
include(${QT_USE_FILE})
include("${QT_USE_FILE}")
add_definitions(${QT_DEFINITIONS})
endif()

Expand Down Expand Up @@ -99,8 +99,8 @@ set(SQLB_RESOURCES

# Translation files
set(SQLB_TSS
${CMAKE_SOURCE_DIR}/src/translations/sqlb_de.ts
${CMAKE_SOURCE_DIR}/src/translations/sqlb_ru.ts
"${CMAKE_SOURCE_DIR}/src/translations/sqlb_de.ts"
"${CMAKE_SOURCE_DIR}/src/translations/sqlb_ru.ts"
)

if(USE_QT5)
Expand All @@ -109,7 +109,7 @@ if(USE_QT5)
if(SQLB_TSS)
# add translations
foreach(SQLB_TS ${SQLB_TSS})
SET_SOURCE_FILES_PROPERTIES(${SQLB_TS} PROPERTIES OUTPUT_LOCATION "${CMAKE_BINARY_DIR}/translations")
SET_SOURCE_FILES_PROPERTIES("${SQLB_TS}" PROPERTIES OUTPUT_LOCATION "${CMAKE_BINARY_DIR}/translations")
endforeach(SQLB_TS ${SQLB_TSS})
qt5_add_translation(SQLB_QMS ${SQLB_TSS})
endif(SQLB_TSS)
Expand All @@ -120,27 +120,29 @@ else()
if(SQLB_TSS)
# add translations
foreach(SQLB_TS ${SQLB_TSS})
SET_SOURCE_FILES_PROPERTIES(${SQLB_TS} PROPERTIES OUTPUT_LOCATION "${CMAKE_BINARY_DIR}/translations")
SET_SOURCE_FILES_PROPERTIES("${SQLB_TS}" PROPERTIES OUTPUT_LOCATION "${CMAKE_BINARY_DIR}/translations")
endforeach(SQLB_TS ${SQLB_TSS})
QT4_ADD_TRANSLATION(SQLB_QMS ${SQLB_TSS})
endif(SQLB_TSS)
endif()

set(gv "${CMAKE_SOURCE_DIR}/src/gen_version.h")

# get git version hash
if(EXISTS ${CMAKE_SOURCE_DIR}/.git)
add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/src/gen_version.h
COMMAND echo "#ifndef GEN_VERSION_H" > ${CMAKE_SOURCE_DIR}/src/gen_version.h
COMMAND echo "#define GEN_VERSION_H" >> ${CMAKE_SOURCE_DIR}/src/gen_version.h
COMMAND git log -n1 "--format=#define APP_VERSION \"%h_git\"" >> ${CMAKE_SOURCE_DIR}/src/gen_version.h
COMMAND echo "#define MAJOR_VERSION 999" >> ${CMAKE_SOURCE_DIR}/src/gen_version.h
COMMAND echo "#define MINOR_VERSION 0" >> ${CMAKE_SOURCE_DIR}/src/gen_version.h
COMMAND echo "#define PATCH_VERSION 0" >> ${CMAKE_SOURCE_DIR}/src/gen_version.h
COMMAND echo "#endif" >> ${CMAKE_SOURCE_DIR}/src/gen_version.h
if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
add_custom_command(OUTPUT "${gv}"
COMMAND echo "#ifndef GEN_VERSION_H" > "${gv}"
COMMAND echo "#define GEN_VERSION_H" >> "${gv}"
COMMAND git log -n1 "--format=#define APP_VERSION \"%h_git\"" >> "${gv}"
COMMAND echo "#define MAJOR_VERSION 999" >> "${gv}"
COMMAND echo "#define MINOR_VERSION 0" >> "${gv}"
COMMAND echo "#define PATCH_VERSION 0" >> "${gv}"
COMMAND echo "#endif" >> "${gv}"
DEPENDS .git/HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
VERBATIM)
else()
file(WRITE ${CMAKE_SOURCE_DIR}/src/gen_version.h
file(WRITE "${gv}"
"#ifndef GEN_VERSION_H\n"
"#define GEN_VERSION_H\n"
"#define APP_VERSION \"3.0.1\"\n"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this "3.0.1" supposed to be the application version number? eg so 3.0.1 is a bug in our source, and we should update it to 3.2.x as appropriate

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am unsure in which application release my update suggestion will be integrated.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries. This version number doesn't really matter that much; it's updated more conscientiously in the release branches. I think it would make most sense to replace it by some '999' dummy version number, just like it's done when the .git directory is found.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool. Done: b355005

Expand All @@ -157,14 +159,14 @@ if(WIN32)

IF( MINGW )
# resource compilation for MinGW
ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/sqlbicon.o
COMMAND windres -I${CMAKE_CURRENT_SOURCE_DIR} -i${CMAKE_CURRENT_SOURCE_DIR}/src/winapp.rc -o ${CMAKE_CURRENT_BINARY_DIR}/sqlbicon.o )
set(SQLB_SRC ${SQLB_SRC} ${CMAKE_CURRENT_BINARY_DIR}/sqlbicon.o)
ADD_CUSTOM_COMMAND(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/sqlbicon.o"
COMMAND windres "-I${CMAKE_CURRENT_SOURCE_DIR}" "-i${CMAKE_CURRENT_SOURCE_DIR}/src/winapp.rc" -o "${CMAKE_CURRENT_BINARY_DIR}/sqlbicon.o" VERBATIM)
set(SQLB_SRC ${SQLB_SRC} "${CMAKE_CURRENT_BINARY_DIR}/sqlbicon.o")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-subsystem,windows")
set(WIN32_STATIC_LINK -Wl,-Bstatic -lssl -lcrypto -lws2_32)
set(ADDITIONAL_LIBS lcms lzma)
ELSE( MINGW )
set(SQLB_SRC ${SQLB_SRC} ${CMAKE_CURRENT_SOURCE_DIR}src/winapp.rc)
set(SQLB_SRC ${SQLB_SRC} "${CMAKE_CURRENT_SOURCE_DIR}src/winapp.rc")
ENDIF( MINGW )
endif(WIN32)

Expand All @@ -177,7 +179,7 @@ else(APPLE)
endif(APPLE)

include_directories(
${CMAKE_CURRENT_BINARY_DIR}
"${CMAKE_CURRENT_BINARY_DIR}"
${ANTLR_DIR}
${QHEXEDIT_DIR}
${QCUSTOMPLOT_DIR}
Expand All @@ -199,9 +201,9 @@ endif()
add_dependencies(${PROJECT_NAME} antlr qhexedit qcustomplot)

link_directories(
${CMAKE_CURRENT_BINARY_DIR}/${ANTLR_DIR}
${CMAKE_CURRENT_BINARY_DIR}/${QHEXEDIT_DIR}
${CMAKE_CURRENT_BINARY_DIR}/${QCUSTOMPLOT_DIR})
"${CMAKE_CURRENT_BINARY_DIR}/${ANTLR_DIR}"
"${CMAKE_CURRENT_BINARY_DIR}/${QHEXEDIT_DIR}"
"${CMAKE_CURRENT_BINARY_DIR}/${QCUSTOMPLOT_DIR}")

target_link_libraries(${PROJECT_NAME}
antlr
Expand Down
2 changes: 1 addition & 1 deletion libs/qcustomplot-source/CMakeLists.txt
Expand Up @@ -6,7 +6,7 @@ if(USE_QT5)
find_package(Qt5Widgets REQUIRED)
else()
find_package(Qt4 COMPONENTS QtCore QtGui REQUIRED)
include(${QT_USE_FILE})
include("${QT_USE_FILE}")
add_definitions(${QT_DEFINITIONS})
endif()

Expand Down
2 changes: 1 addition & 1 deletion libs/qhexedit/CMakeLists.txt
Expand Up @@ -6,7 +6,7 @@ if(USE_QT5)
find_package(Qt5Widgets REQUIRED)
else()
find_package(Qt4 COMPONENTS QtCore QtGui REQUIRED)
include(${QT_USE_FILE})
include("${QT_USE_FILE}")
add_definitions(${QT_DEFINITIONS})
endif()

Expand Down
8 changes: 4 additions & 4 deletions tests/CMakeLists.txt
Expand Up @@ -7,16 +7,16 @@ if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif()

set(ANTLR_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../libs/antlr-2.7.7)
add_subdirectory(${ANTLR_DIR} ${CMAKE_CURRENT_BINARY_DIR}/antlr)
set(ANTLR_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../libs/antlr-2.7.7")
add_subdirectory("${ANTLR_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/antlr")

if(USE_QT5)
find_package(Qt5Widgets REQUIRED)
set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
else()
find_package(Qt4 COMPONENTS QtCore QtTest QtGui REQUIRED)
include(${QT_USE_FILE})
include("${QT_USE_FILE}")
add_definitions(${QT_DEFINITIONS})
endif()

Expand Down Expand Up @@ -54,7 +54,7 @@ if(NOT USE_QT5)
QT4_WRAP_CPP(SQLB_MOC ${SQLB_MOC_HDR})
endif()

include_directories(${ANTLR_DIR} ../src)
include_directories("${ANTLR_DIR}" ../src)

add_executable(${PROJECT_NAME} ${SQLB_MOC} ${SQLB_HDR} ${SQLB_SRC})

Expand Down