From 2fbffa98fab7a75ce604c93d11adecea4a4b09eb Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Sat, 30 Jan 2016 21:11:16 +0000 Subject: [PATCH] Porting back changes of branch-1.3-porting. The old behavior is retained, but the files have been modified to match the new versions in the porting branch as much as possible. The porting branch has its own (modified) version. Windows executables built with the new IDE's (generated by CMake) don't have the trailing 'd' in Debug mode. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@11091 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- test/CMakeLists.txt | 17 ++++++++++++----- test/demo.cxx | 20 ++++++++++++++++++-- 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 82d67e27b..0e0150a6a 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -109,11 +109,18 @@ endif(FLTK_HAVE_CAIRO) # - demo.menu: help (help-test.html) can't find its images (not copied) # - maybe more ... +# prepare for a "better" test file installation path +set (TESTFILE_PATH ${EXECUTABLE_OUTPUT_PATH}) + +# *FIXME* *DEBUG* +# message ("test/CMakeLists.txt: EXECUTABLE_OUTPUT_PATH = '${EXECUTABLE_OUTPUT_PATH}'") +# message ("test/CMakeLists.txt: TESTFILE_PATH = '${TESTFILE_PATH}'") + # use a target filename to make sure the target directory gets created -configure_file(demo.menu ${EXECUTABLE_OUTPUT_PATH}/demo.menu COPYONLY) +configure_file(demo.menu ${TESTFILE_PATH}/demo.menu COPYONLY) # use target directory only to avoid redundancy -configure_file(rgb.txt ${EXECUTABLE_OUTPUT_PATH} COPYONLY) -configure_file(help-test.html ${EXECUTABLE_OUTPUT_PATH} COPYONLY) -configure_file(browser.cxx ${EXECUTABLE_OUTPUT_PATH} COPYONLY) -configure_file(editor.cxx ${EXECUTABLE_OUTPUT_PATH} COPYONLY) +configure_file(rgb.txt ${TESTFILE_PATH} COPYONLY) +configure_file(help-test.html ${TESTFILE_PATH} COPYONLY) +configure_file(browser.cxx ${TESTFILE_PATH} COPYONLY) +configure_file(editor.cxx ${TESTFILE_PATH} COPYONLY) diff --git a/test/demo.cxx b/test/demo.cxx index ca898a2ab..d54de6e55 100644 --- a/test/demo.cxx +++ b/test/demo.cxx @@ -44,6 +44,22 @@ #include #include +/* Define a macro to decide if a trailing 'd' needs to be removed + from the executable file name. Current versions of Visual Studio + bundled IDE solutions add a 'd' to the executable file name + ('demod.exe') in Debug configurations that needs to be removed. + This is no longer true with CMake-generated IDE's starting with + FLTK 1.4, but in FLTK 1.3 the OLD behavior is still used. + The 'old' behavior obviously applied or still applies to + CodeWarrior (__MWERKS__). +*/ + +#if ( defined _MSC_VER || defined __MWERKS__ ) && defined _DEBUG +# define DEBUG_EXE_WITH_D 1 +#else +# define DEBUG_EXE_WITH_D 0 +#endif + /* The form description */ void doexit(Fl_Widget *, void *); @@ -250,7 +266,7 @@ void dobut(Fl_Widget *, long arg) char* command = new char[icommand_length+6]; // 6 for extra 'd.exe\0' if (start_parameters==NULL) { // no parameters required. -# ifdef _DEBUG +# if DEBUG_EXE_WITH_D sprintf(command, "%sd.exe", start_command); # else sprintf(command, "%s.exe", start_command); @@ -412,7 +428,7 @@ int main(int argc, char **argv) { putenv((char *)"FLTK_DOCDIR=../documentation/html"); char buf[FL_PATH_MAX]; strcpy(buf, argv[0]); -#if ( defined _MSC_VER || defined __MWERKS__ ) && defined _DEBUG +#if DEBUG_EXE_WITH_D // MS_VisualC appends a 'd' to debugging executables. remove it. fl_filename_setext( buf, "" ); buf[ strlen(buf)-1 ] = 0;