2007-05-09 23:10:12 +04:00
# this test creates a static library and an executable
2012-08-13 21:42:58 +04:00
# the source to the library is then changed
2007-05-09 23:10:12 +04:00
# and the build is done on the executable and if things
# are working the executable should relink with the new
# value. The subdir Project contains the CMakelists.txt
2012-08-13 21:42:58 +04:00
# and source files for the test project.
2008-03-25 18:27:18 +03:00
cmake_minimum_required ( VERSION 2.6 )
2007-05-09 23:10:12 +04:00
project ( BuildDepends )
2007-06-14 00:26:50 +04:00
2007-12-22 04:19:23 +03:00
# This entire test takes place during the initial
# configure step. It should not run again when the
# project is built.
set ( CMAKE_SUPPRESS_REGENERATION 1 )
2008-05-14 19:55:12 +04:00
# Xcode needs some help with the fancy dependencies in this test.
2013-10-08 22:21:25 +04:00
if ( XCODE AND XCODE_VERSION VERSION_LESS 5 )
2008-05-14 19:55:12 +04:00
set ( HELP_XCODE 1 )
2012-08-13 21:50:14 +04:00
endif ( )
2008-05-14 19:55:12 +04:00
function ( help_xcode_depends )
if ( HELP_XCODE )
file ( GLOB_RECURSE MACRO_OBJS
$ { B u i l d D e p e n d s _ B I N A R Y _ D I R } / P r o j e c t / z o t _ m a c r o _ * . o *
)
if ( MACRO_OBJS )
message ( "Helping Xcode by removing objects [${MACRO_OBJS}]" )
file ( REMOVE ${ MACRO_OBJS } )
2012-08-13 21:50:14 +04:00
endif ( )
endif ( )
endfunction ( )
2008-05-14 19:55:12 +04:00
2009-10-27 18:31:40 +03:00
# The Intel compiler causes the MSVC linker to crash during
# incremental linking, so avoid the /INCREMENTAL:YES flag.
if ( WIN32 AND "${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel" )
set ( _cmake_options "-DCMAKE_EXE_LINKER_FLAGS=" )
endif ( )
2010-11-05 16:05:08 +03:00
if ( "${CMAKE_GENERATOR}" MATCHES "Make" )
set ( TEST_LINK_DEPENDS ${ BuildDepends_BINARY_DIR } /Project/linkdep.txt )
file ( WRITE ${ TEST_LINK_DEPENDS } "1" )
endif ( )
list ( APPEND _cmake_options "-DTEST_LINK_DEPENDS=${TEST_LINK_DEPENDS}" )
2011-11-15 08:39:52 +04:00
list ( APPEND _cmake_options "-DCMAKE_FORCE_DEPFILES=1" )
2015-04-10 20:03:34 +03:00
if ( NOT CMAKE_GENERATOR MATCHES "Visual Studio ([^6789]|[6789][0-9])" )
set ( TEST_MULTI3 1 )
list ( APPEND _cmake_options "-DTEST_MULTI3=1" )
endif ( )
2007-06-14 00:26:50 +04:00
file ( MAKE_DIRECTORY ${ BuildDepends_BINARY_DIR } /Project )
message ( "Creating Project/foo.cxx" )
2012-08-13 21:42:58 +04:00
write_file ( ${ BuildDepends_BINARY_DIR } /Project/foo.cxx
2007-05-09 23:10:12 +04:00
" c o n s t c h a r * foo ( ) { r e t u r n \ " f o o \ " ; } " )
2007-06-14 00:26:50 +04:00
2007-09-17 18:51:05 +04:00
file ( WRITE ${ BuildDepends_BINARY_DIR } /Project/zot.hxx.in
" s t a t i c c o n s t c h a r * z o t = \ " z o t \ " ; \ n " )
2013-07-23 22:53:00 +04:00
file ( WRITE ${ BuildDepends_BINARY_DIR } /Project/dir/header.txt
" #define HEADER_STRING \"ninja\"\n" )
2007-12-21 20:22:12 +03:00
file ( WRITE ${ BuildDepends_BINARY_DIR } /Project/zot_custom.hxx.in
" s t a t i c c o n s t c h a r * z o t _ c u s t o m = \ " z o t _ c u s t o m \ " ; \ n " )
2008-05-14 19:55:12 +04:00
file ( WRITE ${ BuildDepends_BINARY_DIR } /Project/zot_macro_dir.hxx
" s t a t i c c o n s t c h a r * z o t _ m a c r o _ d i r = \ " z o t _ m a c r o _ d i r \ " ; \ n " )
file ( WRITE ${ BuildDepends_BINARY_DIR } /Project/zot_macro_tgt.hxx
" s t a t i c c o n s t c h a r * z o t _ m a c r o _ t g t = \ " z o t _ m a c r o _ t g t \ " ; \ n " )
2012-11-09 18:26:51 +04:00
file ( WRITE ${ BuildDepends_BINARY_DIR } /Project/link_depends_no_shared_lib.h
" #define link_depends_no_shared_lib_value 1\n")
file ( WRITE ${ BuildDepends_BINARY_DIR } /Project/link_depends_no_shared_exe.h
" #define link_depends_no_shared_exe_value 0\n")
set ( link_depends_no_shared_check_txt ${ BuildDepends_BINARY_DIR } /Project/link_depends_no_shared_check.txt )
2014-02-21 19:59:06 +04:00
file ( WRITE ${ BuildDepends_BINARY_DIR } /Project/external.in "external original\n" )
2014-12-05 17:56:26 +03:00
file ( WRITE ${ BuildDepends_BINARY_DIR } /Project/multi1-in.txt "multi1-in original\n" )
2015-04-10 20:03:34 +03:00
file ( WRITE ${ BuildDepends_BINARY_DIR } /Project/multi2-stamp.txt "multi2-stamp original\n" )
file ( WRITE ${ BuildDepends_BINARY_DIR } /Project/multi3-stamp.txt "multi3-stamp original\n" )
2014-02-21 19:59:06 +04:00
2008-05-14 19:55:12 +04:00
help_xcode_depends ( )
2007-09-17 18:51:05 +04:00
2007-06-14 00:26:50 +04:00
message ( "Building project first time" )
2012-08-13 21:42:58 +04:00
try_compile ( RESULT
2007-05-09 23:10:12 +04:00
$ { B u i l d D e p e n d s _ B I N A R Y _ D I R } / P r o j e c t
$ { B u i l d D e p e n d s _ S O U R C E _ D I R } / P r o j e c t
t e s t R e b u i l d
2009-10-27 18:31:40 +03:00
C M A K E _ F L A G S $ { _ c m a k e _ o p t i o n s }
2007-05-09 23:10:12 +04:00
O U T P U T _ V A R I A B L E O U T P U T )
2008-05-14 19:55:12 +04:00
if ( HELP_XCODE )
2012-08-13 21:42:58 +04:00
try_compile ( RESULT
2007-05-24 01:58:14 +04:00
$ { B u i l d D e p e n d s _ B I N A R Y _ D I R } / P r o j e c t
$ { B u i l d D e p e n d s _ S O U R C E _ D I R } / P r o j e c t
t e s t R e b u i l d
O U T P U T _ V A R I A B L E O U T P U T )
2012-08-13 21:42:58 +04:00
try_compile ( RESULT
2007-05-24 01:58:14 +04:00
$ { B u i l d D e p e n d s _ B I N A R Y _ D I R } / P r o j e c t
$ { B u i l d D e p e n d s _ S O U R C E _ D I R } / P r o j e c t
t e s t R e b u i l d
O U T P U T _ V A R I A B L E O U T P U T )
2012-08-13 21:50:14 +04:00
endif ( )
2007-05-24 01:58:14 +04:00
2009-10-22 17:35:58 +04:00
message ( "Output from first build:\n${OUTPUT}" )
2007-05-16 15:55:00 +04:00
if ( NOT RESULT )
2009-10-22 17:35:58 +04:00
message ( SEND_ERROR "Could not build test project (1)!" )
2012-08-13 21:50:14 +04:00
endif ( )
2007-05-16 15:55:00 +04:00
2013-07-23 22:53:00 +04:00
# find and save the ninjadep executable
set ( ninjadep ${ BuildDepends_BINARY_DIR } /Project/ninjadep ${ CMAKE_EXECUTABLE_SUFFIX } )
if ( EXISTS
" $ { B u i l d D e p e n d s _ B I N A R Y _ D I R } / P r o j e c t / D e b u g / n i n j a d e p $ { C M A K E _ E X E C U T A B L E _ S U F F I X } " )
message ( "found debug" )
set ( ninjadep
" $ { B u i l d D e p e n d s _ B I N A R Y _ D I R } / P r o j e c t / D e b u g / n i n j a d e p $ { C M A K E _ E X E C U T A B L E _ S U F F I X } " )
endif ( )
message ( "Running ${ninjadep} " )
execute_process ( COMMAND ${ ninjadep } OUTPUT_VARIABLE out RESULT_VARIABLE runResult )
string ( REGEX REPLACE "[\r\n]" " " out "${out}" )
message ( "Run result: ${runResult} Output: \" ${ out } \"")
if ( "${out}" STREQUAL "HEADER_STRING: ninja " )
message ( "Worked!" )
else ( )
message ( SEND_ERROR "Project did not rebuild properly. Output[${out}]\n"
" e x p e c t e d [ H E A D E R _ S T R I N G : n i n j a ] " )
endif ( )
2007-05-10 18:05:52 +04:00
set ( bar ${ BuildDepends_BINARY_DIR } /Project/bar ${ CMAKE_EXECUTABLE_SUFFIX } )
2012-08-13 21:42:58 +04:00
if ( EXISTS
2007-05-10 18:05:52 +04:00
" $ { B u i l d D e p e n d s _ B I N A R Y _ D I R } / P r o j e c t / D e b u g / b a r $ { C M A K E _ E X E C U T A B L E _ S U F F I X } " )
message ( "found debug" )
2012-08-13 21:42:58 +04:00
set ( bar
2007-05-10 18:05:52 +04:00
" $ { B u i l d D e p e n d s _ B I N A R Y _ D I R } / P r o j e c t / D e b u g / b a r $ { C M A K E _ E X E C U T A B L E _ S U F F I X } " )
2012-08-15 19:59:36 +04:00
endif ( )
2007-09-17 18:51:05 +04:00
set ( zot ${ BuildDepends_BINARY_DIR } /Project/zot ${ CMAKE_EXECUTABLE_SUFFIX } )
2012-08-13 21:42:58 +04:00
if ( EXISTS
2007-09-17 18:51:05 +04:00
" $ { B u i l d D e p e n d s _ B I N A R Y _ D I R } / P r o j e c t / D e b u g / z o t $ { C M A K E _ E X E C U T A B L E _ S U F F I X } " )
message ( "found debug" )
2012-08-13 21:42:58 +04:00
set ( zot
2007-09-17 18:51:05 +04:00
" $ { B u i l d D e p e n d s _ B I N A R Y _ D I R } / P r o j e c t / D e b u g / z o t $ { C M A K E _ E X E C U T A B L E _ S U F F I X } " )
2012-08-15 19:59:36 +04:00
endif ( )
2007-06-14 00:26:50 +04:00
message ( "Running ${bar} " )
execute_process ( COMMAND ${ bar } OUTPUT_VARIABLE out RESULT_VARIABLE runResult )
2007-05-10 18:05:52 +04:00
string ( REGEX REPLACE "[\r\n]" " " out "${out}" )
2007-06-14 00:26:50 +04:00
message ( "Run result: ${runResult} Output: \" ${ out } \"")
2007-05-10 18:05:52 +04:00
if ( "${out}" STREQUAL "foo " )
2007-05-09 23:10:12 +04:00
message ( "Worked!" )
2012-08-13 21:50:14 +04:00
else ( )
2007-05-24 01:58:14 +04:00
message ( SEND_ERROR "Project did not initially build properly: ${out}" )
2012-08-13 21:50:14 +04:00
endif ( )
2007-05-09 23:10:12 +04:00
2007-09-17 18:51:05 +04:00
message ( "Running ${zot} " )
execute_process ( COMMAND ${ zot } OUTPUT_VARIABLE out RESULT_VARIABLE runResult )
string ( REGEX REPLACE "[\r\n]" " " out "${out}" )
message ( "Run result: ${runResult} Output: \" ${ out } \"")
2008-05-14 19:55:12 +04:00
set ( VALUE_UNCHANGED "[zot] [zot_custom] [zot_macro_dir] [zot_macro_tgt] " )
if ( "${out}" STREQUAL "${VALUE_UNCHANGED}" )
2007-09-17 18:51:05 +04:00
message ( "Worked!" )
2012-08-13 21:50:14 +04:00
else ( )
2007-09-17 18:51:05 +04:00
message ( SEND_ERROR "Project did not initially build properly: ${out}" )
2012-08-13 21:50:14 +04:00
endif ( )
2007-09-17 18:51:05 +04:00
2012-11-09 18:26:51 +04:00
if ( EXISTS "${link_depends_no_shared_check_txt}" )
file ( STRINGS "${link_depends_no_shared_check_txt}" link_depends_no_shared_check LIMIT_COUNT 1 )
if ( "${link_depends_no_shared_check}" STREQUAL "1" )
message ( STATUS "link_depends_no_shared_exe is newer than link_depends_no_shared_lib as expected." )
else ( )
message ( SEND_ERROR "Project did not initially build properly: "
" l i n k _ d e p e n d s _ n o _ s h a r e d _ e x e i s o l d e r t h a n l i n k _ d e p e n d s _ n o _ s h a r e d _ l i b . " )
endif ( )
else ( )
message ( SEND_ERROR "Project did not initially build properly: "
" T a r g e t s l i n k _ d e p e n d s _ n o _ s h a r e d _ l i b a n d l i n k _ d e p e n d s _ n o _ s h a r e d _ e x e n o t b o t h b u i l t . " )
endif ( )
2014-02-21 19:59:06 +04:00
if ( EXISTS ${ BuildDepends_BINARY_DIR } /Project/external.out )
file ( STRINGS ${ BuildDepends_BINARY_DIR } /Project/external.out external_out )
if ( "${external_out}" STREQUAL "external original" )
message ( STATUS "external.out contains '${external_out}'" )
else ( )
message ( SEND_ERROR "Project did not initially build properly: "
" e x t e r n a l . o u t c o n t a i n s ' $ { e x t e r n a l _ o u t } ' " )
endif ( )
else ( )
message ( SEND_ERROR "Project did not initially build properly: "
" e x t e r n a l . o u t i s m i s s i n g " )
endif ( )
2014-12-05 17:56:26 +03:00
if ( EXISTS ${ BuildDepends_BINARY_DIR } /Project/multi1-out2-copy.txt )
file ( STRINGS ${ BuildDepends_BINARY_DIR } /Project/multi1-out2-copy.txt multi1_out )
if ( "${multi1_out}" STREQUAL "multi1-in original" )
message ( STATUS "multi1-out2-copy.txt contains '${multi1_out}'" )
else ( )
message ( SEND_ERROR "Project did not initially build properly: "
" m u l t i 1 - o u t 2 - c o p y . t x t c o n t a i n s ' $ { m u l t i 1 _ o u t } ' " )
endif ( )
else ( )
message ( SEND_ERROR "Project did not initially build properly: "
" m u l t i 1 - o u t 2 - c o p y . t x t i s m i s s i n g " )
endif ( )
2015-04-10 20:03:34 +03:00
if ( EXISTS ${ BuildDepends_BINARY_DIR } /Project/multi2-real.txt )
if ( ${ BuildDepends_BINARY_DIR } /Project/multi2-real.txt
I S _ N E W E R _ T H A N $ { B u i l d D e p e n d s _ B I N A R Y _ D I R } / P r o j e c t / m u l t i 2 - s t a m p . t x t )
message ( STATUS "multi2-real.txt is newer than multi2-stamp.txt" )
else ( )
message ( SEND_ERROR "Project did not initially build properly: "
" m u l t i 2 - r e a l . t x t i s n o t n e w e r t h a n m u l t i 2 - s t a m p . t x t " )
endif ( )
else ( )
message ( SEND_ERROR "Project did not initially build properly: "
" m u l t i 2 - r e a l . t x t i s m i s s i n g " )
endif ( )
if ( TEST_MULTI3 )
if ( EXISTS ${ BuildDepends_BINARY_DIR } /Project/multi3-real.txt )
if ( ${ BuildDepends_BINARY_DIR } /Project/multi3-real.txt
I S _ N E W E R _ T H A N $ { B u i l d D e p e n d s _ B I N A R Y _ D I R } / P r o j e c t / m u l t i 3 - s t a m p . t x t )
message ( STATUS "multi3-real.txt is newer than multi3-stamp.txt" )
else ( )
message ( SEND_ERROR "Project did not initially build properly: "
" m u l t i 3 - r e a l . t x t i s n o t n e w e r t h a n m u l t i 3 - s t a m p . t x t " )
endif ( )
else ( )
message ( SEND_ERROR "Project did not initially build properly: "
" m u l t i 3 - r e a l . t x t i s m i s s i n g " )
endif ( )
endif ( )
2007-06-14 00:26:50 +04:00
message ( "Waiting 3 seconds..." )
2014-05-19 18:50:11 +04:00
execute_process ( COMMAND ${ CMAKE_COMMAND } -E sleep 3 )
2007-06-14 00:26:50 +04:00
message ( "Modifying Project/foo.cxx" )
2007-05-16 15:55:00 +04:00
write_file ( ${ BuildDepends_BINARY_DIR } /Project/foo.cxx
2007-05-09 23:10:12 +04:00
" c o n s t c h a r * foo ( ) { r e t u r n \ " f o o c h a n g e d \ " ; } " )
2013-07-23 22:53:00 +04:00
file ( WRITE "${BuildDepends_BINARY_DIR}/Project/dir/header.txt"
" #define HEADER_STRING \"ninja changed\"\n" )
2007-09-17 18:51:05 +04:00
file ( WRITE ${ BuildDepends_BINARY_DIR } /Project/zot.hxx.in
" s t a t i c c o n s t c h a r * z o t = \ " z o t c h a n g e d \ " ; \ n " )
2007-12-21 20:22:12 +03:00
file ( WRITE ${ BuildDepends_BINARY_DIR } /Project/zot_custom.hxx.in
" s t a t i c c o n s t c h a r * z o t _ c u s t o m = \ " z o t _ c u s t o m c h a n g e d \ " ; \ n " )
2008-05-14 19:55:12 +04:00
file ( WRITE ${ BuildDepends_BINARY_DIR } /Project/zot_macro_dir.hxx
" s t a t i c c o n s t c h a r * z o t _ m a c r o _ d i r = \ " z o t _ m a c r o _ d i r c h a n g e d \ " ; \ n " )
file ( WRITE ${ BuildDepends_BINARY_DIR } /Project/zot_macro_tgt.hxx
" s t a t i c c o n s t c h a r * z o t _ m a c r o _ t g t = \ " z o t _ m a c r o _ t g t c h a n g e d \ " ; \ n " )
2012-11-09 18:26:51 +04:00
file ( WRITE ${ BuildDepends_BINARY_DIR } /Project/link_depends_no_shared_lib.h
" #define link_depends_no_shared_lib_value 0\n")
2010-11-05 16:05:08 +03:00
if ( TEST_LINK_DEPENDS )
file ( WRITE ${ TEST_LINK_DEPENDS } "2" )
endif ( )
2014-02-21 19:59:06 +04:00
file ( WRITE ${ BuildDepends_BINARY_DIR } /Project/external.in "external changed\n" )
2014-12-05 17:56:26 +03:00
file ( WRITE ${ BuildDepends_BINARY_DIR } /Project/multi1-in.txt "multi1-in changed\n" )
2015-04-10 20:03:34 +03:00
file ( WRITE ${ BuildDepends_BINARY_DIR } /Project/multi2-stamp.txt "multi2-stamp changed\n" )
file ( WRITE ${ BuildDepends_BINARY_DIR } /Project/multi3-stamp.txt "multi3-stamp changed\n" )
2014-02-21 19:59:06 +04:00
2008-05-14 19:55:12 +04:00
help_xcode_depends ( )
2007-06-14 00:26:50 +04:00
message ( "Building project second time" )
2012-08-13 21:42:58 +04:00
try_compile ( RESULT
2007-05-09 23:10:12 +04:00
$ { B u i l d D e p e n d s _ B I N A R Y _ D I R } / P r o j e c t
$ { B u i l d D e p e n d s _ S O U R C E _ D I R } / P r o j e c t
t e s t R e b u i l d
2009-10-27 18:31:40 +03:00
C M A K E _ F L A G S $ { _ c m a k e _ o p t i o n s }
2007-05-09 23:10:12 +04:00
O U T P U T _ V A R I A B L E O U T P U T )
2007-05-24 01:58:14 +04:00
# Xcode is in serious need of help here
2014-11-13 21:19:13 +03:00
if ( HELP_XCODE )
2012-08-13 21:42:58 +04:00
try_compile ( RESULT
2007-05-24 01:58:14 +04:00
$ { B u i l d D e p e n d s _ B I N A R Y _ D I R } / P r o j e c t
$ { B u i l d D e p e n d s _ S O U R C E _ D I R } / P r o j e c t
t e s t R e b u i l d
O U T P U T _ V A R I A B L E O U T P U T )
2012-08-13 21:42:58 +04:00
try_compile ( RESULT
2007-05-24 01:58:14 +04:00
$ { B u i l d D e p e n d s _ B I N A R Y _ D I R } / P r o j e c t
$ { B u i l d D e p e n d s _ S O U R C E _ D I R } / P r o j e c t
t e s t R e b u i l d
O U T P U T _ V A R I A B L E O U T P U T )
2012-06-08 18:31:54 +04:00
endif ( )
2007-05-24 01:58:14 +04:00
2009-10-22 17:35:58 +04:00
message ( "Output from second build:\n${OUTPUT}" )
2007-05-16 15:55:00 +04:00
if ( NOT RESULT )
2009-10-22 17:35:58 +04:00
message ( SEND_ERROR "Could not build test project (2)!" )
2012-08-13 21:50:14 +04:00
endif ( )
2012-08-13 21:42:58 +04:00
if ( EXISTS
2007-05-10 18:05:52 +04:00
" $ { B u i l d D e p e n d s _ B I N A R Y _ D I R } / P r o j e c t / D e b u g / b a r $ { C M A K E _ E X E C U T A B L E _ S U F F I X } " )
message ( "found debug" )
2012-08-15 19:59:36 +04:00
endif ( )
2012-08-13 21:42:58 +04:00
if ( EXISTS
2007-09-17 18:51:05 +04:00
" $ { B u i l d D e p e n d s _ B I N A R Y _ D I R } / P r o j e c t / D e b u g / z o t $ { C M A K E _ E X E C U T A B L E _ S U F F I X } " )
message ( "found debug" )
2012-08-15 19:59:36 +04:00
endif ( )
2007-05-10 18:05:52 +04:00
2013-07-23 22:53:00 +04:00
message ( "Running ${ninjadep} " )
execute_process ( COMMAND ${ ninjadep } OUTPUT_VARIABLE out RESULT_VARIABLE runResult )
string ( REGEX REPLACE "[\r\n]" " " out "${out}" )
message ( "Run result: ${runResult} Output: \" ${ out } \"")
if ( "${out}" STREQUAL "HEADER_STRING: ninja changed " )
message ( "Worked!" )
2013-07-30 17:41:46 +04:00
elseif ( CMAKE_GENERATOR STREQUAL "Visual Studio 6" )
# Tolerate failure because VS 6 does not seem to recompile ninjadep.cpp
# when the "dir/header.h" it includes changes.
2013-07-23 22:53:00 +04:00
else ( )
message ( SEND_ERROR "Project did not rebuild properly. Output[${out}]\n"
" e x p e c t e d [ H E A D E R _ S T R I N G : n i n j a c h a n g e d ] " )
endif ( )
2007-06-14 00:26:50 +04:00
message ( "Running ${bar} " )
execute_process ( COMMAND ${ bar } OUTPUT_VARIABLE out RESULT_VARIABLE runResult )
2007-05-10 18:05:52 +04:00
string ( REGEX REPLACE "[\r\n]" " " out "${out}" )
2007-06-14 00:26:50 +04:00
message ( "Run result: ${runResult} Output: \" ${ out } \"")
2007-05-09 23:10:12 +04:00
2007-05-10 18:05:52 +04:00
if ( "${out}" STREQUAL "foo changed " )
2007-05-09 23:10:12 +04:00
message ( "Worked!" )
2012-08-13 21:50:14 +04:00
else ( )
2007-05-23 21:27:00 +04:00
message ( SEND_ERROR "Project did not rebuild properly!" )
2012-08-13 21:50:14 +04:00
endif ( )
2007-09-17 18:51:05 +04:00
message ( "Running ${zot} " )
execute_process ( COMMAND ${ zot } OUTPUT_VARIABLE out RESULT_VARIABLE runResult )
string ( REGEX REPLACE "[\r\n]" " " out "${out}" )
message ( "Run result: ${runResult} Output: \" ${ out } \"")
2008-05-14 19:55:12 +04:00
set ( VALUE_CHANGED
" [ z o t c h a n g e d ] [ z o t _ c u s t o m c h a n g e d ] [ z o t _ m a c r o _ d i r c h a n g e d ] [ z o t _ m a c r o _ t g t c h a n g e d ] "
)
if ( "${out}" STREQUAL "${VALUE_CHANGED}" )
2007-09-17 18:51:05 +04:00
message ( "Worked!" )
2012-08-13 21:50:14 +04:00
else ( )
2007-09-17 18:51:05 +04:00
message ( SEND_ERROR "Project did not rebuild properly!" )
2012-08-13 21:50:14 +04:00
endif ( )
2010-11-05 16:05:08 +03:00
if ( TEST_LINK_DEPENDS )
set ( linkdep ${ BuildDepends_BINARY_DIR } /Project/linkdep ${ CMAKE_EXECUTABLE_SUFFIX } )
if ( ${ linkdep } IS_NEWER_THAN ${ TEST_LINK_DEPENDS } )
message ( "LINK_DEPENDS worked" )
else ( )
message ( SEND_ERROR " LINK_DEPENDS failed. Executable
$ { l i n k d e p }
i s n o t n e w e r t h a n d e p e n d e n c y
$ { T E S T _ L I N K _ D E P E N D S }
" )
endif ( )
endif ( )
2012-11-09 18:26:51 +04:00
if ( EXISTS "${link_depends_no_shared_check_txt}" )
file ( STRINGS "${link_depends_no_shared_check_txt}" link_depends_no_shared_check LIMIT_COUNT 1 )
if ( "${link_depends_no_shared_check}" STREQUAL "0" )
message ( STATUS "link_depends_no_shared_exe is older than link_depends_no_shared_lib as expected." )
2013-10-02 19:34:21 +04:00
elseif ( XCODE AND NOT XCODE_VERSION VERSION_LESS 5 )
message ( STATUS "Known limitation: link_depends_no_shared_exe is newer than link_depends_no_shared_lib but we cannot stop Xcode ${XCODE_VERSION} from enforcing this dependency." )
2012-11-09 18:26:51 +04:00
else ( )
message ( SEND_ERROR "Project did not rebuild properly: link_depends_no_shared_exe is newer than link_depends_no_shared_lib." )
endif ( )
else ( )
message ( SEND_ERROR "Project did not rebuild properly. "
" T a r g e t s l i n k _ d e p e n d s _ n o _ s h a r e d _ l i b a n d l i n k _ d e p e n d s _ n o _ s h a r e d _ e x e n o t b o t h b u i l t . " )
endif ( )
2014-02-21 19:59:06 +04:00
if ( EXISTS ${ BuildDepends_BINARY_DIR } /Project/external.out )
file ( STRINGS ${ BuildDepends_BINARY_DIR } /Project/external.out external_out )
if ( "${external_out}" STREQUAL "external changed" )
message ( STATUS "external.out contains '${external_out}'" )
else ( )
message ( SEND_ERROR "Project did not rebuild properly: "
" e x t e r n a l . o u t c o n t a i n s ' $ { e x t e r n a l _ o u t } ' " )
endif ( )
else ( )
message ( SEND_ERROR "Project did not rebuild properly: "
" e x t e r n a l . o u t i s m i s s i n g " )
endif ( )
2014-12-05 17:56:26 +03:00
if ( EXISTS ${ BuildDepends_BINARY_DIR } /Project/multi1-out2-copy.txt )
file ( STRINGS ${ BuildDepends_BINARY_DIR } /Project/multi1-out2-copy.txt multi1_out )
if ( "${multi1_out}" STREQUAL "multi1-in changed" )
message ( STATUS "multi1-out2-copy.txt contains '${multi1_out}'" )
else ( )
message ( SEND_ERROR "Project did not rebuild properly: "
" m u l t i 1 - o u t 2 - c o p y . t x t c o n t a i n s ' $ { m u l t i 1 _ o u t } ' " )
endif ( )
else ( )
message ( SEND_ERROR "Project did not rebuild properly: "
" m u l t i 1 - o u t 2 - c o p y . t x t i s m i s s i n g " )
endif ( )
2015-04-10 20:03:34 +03:00
if ( EXISTS ${ BuildDepends_BINARY_DIR } /Project/multi2-real.txt )
if ( ${ BuildDepends_BINARY_DIR } /Project/multi2-real.txt
I S _ N E W E R _ T H A N $ { B u i l d D e p e n d s _ B I N A R Y _ D I R } / P r o j e c t / m u l t i 2 - s t a m p . t x t )
message ( STATUS "multi2-real.txt is newer than multi2-stamp.txt" )
else ( )
message ( SEND_ERROR "Project did not rebuild properly: "
" m u l t i 2 - r e a l . t x t i s n o t n e w e r t h a n m u l t i 2 - s t a m p . t x t " )
endif ( )
else ( )
message ( SEND_ERROR "Project did not rebuild properly: "
" m u l t i 2 - r e a l . t x t i s m i s s i n g " )
endif ( )
if ( TEST_MULTI3 )
if ( EXISTS ${ BuildDepends_BINARY_DIR } /Project/multi3-real.txt )
if ( ${ BuildDepends_BINARY_DIR } /Project/multi3-real.txt
I S _ N E W E R _ T H A N $ { B u i l d D e p e n d s _ B I N A R Y _ D I R } / P r o j e c t / m u l t i 3 - s t a m p . t x t )
message ( STATUS "multi3-real.txt is newer than multi3-stamp.txt" )
else ( )
message ( SEND_ERROR "Project did not rebuild properly: "
" m u l t i 3 - r e a l . t x t i s n o t n e w e r t h a n m u l t i 3 - s t a m p . t x t " )
endif ( )
else ( )
message ( SEND_ERROR "Project did not rebuild properly: "
" m u l t i 3 - r e a l . t x t i s m i s s i n g " )
endif ( )
endif ( )