Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
CMake
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2,686
Issues
2,686
List
Boards
Labels
Milestones
Merge Requests
23
Merge Requests
23
Packages
Packages
Container Registry
External Wiki
External Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
CMake
CMake
Commits
17c31b8b
Commit
17c31b8b
authored
Apr 30, 2014
by
Stephen Kelly
Committed by
Brad King
May 06, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt4: Extend the Qt4Targets test to cover dir and target moc parameters.
parent
6a5bd7f0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
25 deletions
+48
-25
Tests/Qt4Targets/CMakeLists.txt
Tests/Qt4Targets/CMakeLists.txt
+38
-23
Tests/Qt4Targets/IncrementalMoc/CMakeLists.txt
Tests/Qt4Targets/IncrementalMoc/CMakeLists.txt
+10
-2
No files found.
Tests/Qt4Targets/CMakeLists.txt
View file @
17c31b8b
...
...
@@ -37,29 +37,44 @@ set_property(TARGET Qt4WrapMacroTest PROPERTY AUTOMOC OFF)
target_include_directories
(
Qt4WrapMacroTest PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/interface"
)
target_link_libraries
(
Qt4WrapMacroTest Qt4::QtGui
)
set
(
timeformat
"%Y%j%H%M%S"
)
try_compile
(
RESULT
"
${
CMAKE_CURRENT_BINARY_DIR
}
/IncrementalMocBuild"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/IncrementalMoc"
IncrementalMoc
CMAKE_FLAGS -DADD_DEF=0
"-DQT_QMAKE_EXECUTABLE:FILEPATH=
${
QT_QMAKE_EXECUTABLE
}
"
)
file
(
TIMESTAMP
"
${
CMAKE_CURRENT_BINARY_DIR
}
/IncrementalMocBuild/moc_foo.cpp"
tsvar_before
"
${
timeformat
}
"
)
if
(
NOT tsvar_before
)
message
(
SEND_ERROR
"Unable to read timestamp from moc file from first build!"
)
endif
()
macro
(
test_incremental def
)
set
(
timeformat
"%Y%j%H%M%S"
)
try_compile
(
RESULT
"
${
CMAKE_CURRENT_BINARY_DIR
}
/IncrementalMocBuild_
${
def
}
"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/IncrementalMoc"
IncrementalMoc
CMAKE_FLAGS -D
${
def
}
=0
"-DQT_QMAKE_EXECUTABLE:FILEPATH=
${
QT_QMAKE_EXECUTABLE
}
"
OUTPUT_VARIABLE output
)
file
(
TIMESTAMP
"
${
CMAKE_CURRENT_BINARY_DIR
}
/IncrementalMocBuild_
${
def
}
/moc_foo.cpp"
tsvar_before
"
${
timeformat
}
"
)
if
(
NOT tsvar_before
)
message
(
SEND_ERROR
"Unable to read timestamp from moc file from first build with -D
${
def
}
!
\n
"
"try_compile output:
\n
${
output
}
"
)
endif
()
execute_process
(
COMMAND
"
${
CMAKE_COMMAND
}
"
-E sleep 2
)
# Ensure that the timestamp will change.
execute_process
(
COMMAND
"
${
CMAKE_COMMAND
}
"
-E sleep 2
)
# Ensure that the timestamp will change.
try_compile
(
RESULT
"
${
CMAKE_CURRENT_BINARY_DIR
}
/IncrementalMocBuild"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/IncrementalMoc"
IncrementalMoc
CMAKE_FLAGS -DADD_DEF=1
"-DQT_QMAKE_EXECUTABLE:FILEPATH=
${
QT_QMAKE_EXECUTABLE
}
"
)
file
(
TIMESTAMP
"
${
CMAKE_CURRENT_BINARY_DIR
}
/IncrementalMocBuild/moc_foo.cpp"
tsvar_after
"
${
timeformat
}
"
)
if
(
NOT tsvar_after
)
message
(
SEND_ERROR
"Unable to read timestamp from moc file from second build!"
)
endif
()
try_compile
(
RESULT
"
${
CMAKE_CURRENT_BINARY_DIR
}
/IncrementalMocBuild_
${
def
}
"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/IncrementalMoc"
IncrementalMoc
CMAKE_FLAGS -D
${
def
}
=1
"-DQT_QMAKE_EXECUTABLE:FILEPATH=
${
QT_QMAKE_EXECUTABLE
}
"
OUTPUT_VARIABLE output
)
file
(
TIMESTAMP
"
${
CMAKE_CURRENT_BINARY_DIR
}
/IncrementalMocBuild_
${
def
}
/moc_foo.cpp"
tsvar_after
"
${
timeformat
}
"
)
if
(
NOT tsvar_after
)
message
(
SEND_ERROR
"Unable to read timestamp from moc file from second build!
\n
"
"try_compile output:
\n
${
output
}
"
)
endif
()
if
(
NOT tsvar_after GREATER tsvar_before
)
message
(
SEND_ERROR
"Rebuild did not re-create moc file. Before:
${
tsvar_before
}
. After:
${
tsvar_after
}
"
)
endif
()
if
(
NOT tsvar_after GREATER tsvar_before
)
message
(
SEND_ERROR
"Rebuild did not re-create moc file with -D
${
def
}
. Before:
${
tsvar_before
}
. After:
${
tsvar_after
}
"
)
endif
()
endmacro
()
test_incremental
(
ADD_TARGET_DEF
)
test_incremental
(
ADD_DIR_DEF
)
Tests/Qt4Targets/IncrementalMoc/CMakeLists.txt
View file @
17c31b8b
...
...
@@ -4,10 +4,18 @@ project(IncrementalMoc)
find_package
(
Qt4 REQUIRED
)
qt4_generate_moc
(
foo.h moc_foo.cpp
)
if
(
ADD_TARGET_DEF
)
set
(
target_args TARGET testlib
)
endif
()
if
(
ADD_DIR_DEF
)
add_definitions
(
-DNEW_DEF
)
endif
()
qt4_generate_moc
(
foo.h moc_foo.cpp
${
target_args
}
)
add_library
(
testlib foo.cpp moc_foo.cpp
)
target_link_libraries
(
testlib Qt4::QtCore
)
if
(
ADD_DEF
)
if
(
ADD_
TARGET_
DEF
)
target_compile_definitions
(
testlib PRIVATE NEW_DEF
)
endif
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment