Re: [CMake] Using Eclipse CDT, CMake resets Eclipse project configuration frequently
Thanks! FYI, I've created some macros to do the copying. Haven't thoroughly tested them yet, but they appear to be working. MACRO(COPY_FILE_IF_CHANGED in_file out_file target) ADD_CUSTOM_COMMAND ( TARGET ${target} POST_BUILD COMMAND${CMAKE_COMMAND} ARGS -E copy_if_different ${in_file} ${out_file} ) message("copying: ${in_file} to ${out_file}") ENDMACRO(COPY_FILE_IF_CHANGED) MACRO(COPY_FILE_INTO_DIRECTORY_IF_CHANGED in_file out_dir target) GET_FILENAME_COMPONENT(file_name ${in_file} NAME) COPY_FILE_IF_CHANGED(${in_file} ${out_dir}/${file_name} ${target}) ENDMACRO(COPY_FILE_INTO_DIRECTORY_IF_CHANGED) MACRO(COPY_DIRECTORY_IF_CHANGED in_dir out_dir target) FILE(GLOB_RECURSE copy_files ${in_dir}/*) FOREACH(in_file ${copy_files}) STRING(REGEX REPLACE ${in_dir} ${out_dir} out_file ${in_file}) COPY_FILE_IF_CHANGED(${in_file} ${out_file} ${target}) ENDFOREACH(in_file) ENDMACRO(COPY_DIRECTORY_IF_CHANGED) Jonatan - This e-mail is intended exclusively for the addressee. If you are not the addressee you must not read, copy, use or disclose the e-mail nor the content; please notify us immediately [by clicking 'Reply'] and delete this e-mail. ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Using Eclipse CDT, CMake resets Eclipse project configuration frequently
2009/1/30 Jonatan Bijl : > > I have now set up the tree so that the executables can be run > immediately from where they are created. I use configure_file to copy > the files. The problem is now, that every time I do a re-configure, the > files (including a dll that is very big) are copied. Is there a way of > making sure the files are copied *only* when they are renewed? I thought configure_file would only copy the file if it has changed [ not that you should use COPYONLY configure_file(InputFile OutputFile COPYONLY) ] however if it is not the case you may replace your configure_file with EXECUTE_PROCESS(${CMAKE_COMMAND} -E copy_if_different InputFile OutputFile) > (and also making sure they are removed when the original is removed?) don't really know how to do that -- Erk ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Using Eclipse CDT, CMake resets Eclipse project configuration frequently
I use the following to copy some test files from one directory to another: SET (HDF5_REFERENCE_TEST_FILES tnullspace.h5 family_v1.7_3.h5 family_v1.7_1.h5 mergemsg.h5 tbogus.h5 tbad_msg_count.h5 group_new.h5 deflate.h5 noencoder.h5 family_v1.7_0.h5 le_extlink1.h5 tmtimeo.h5 tmtimen.h5 fill_old.h5 tlayouto.h5 family_v1.7_2.h5 th5s.h5 tarrold.h5 ) FOREACH ( h5_file ${HDF5_REFERENCE_TEST_FILES} ) SET (dest "${PROJECT_BINARY_DIR}/${h5_file}") MESSAGE(STATUS " Copying ${dest}") ADD_CUSTOM_COMMAND ( TARGET ${HDF5_TEST_LIB_NAME} POST_BUILD COMMAND${CMAKE_COMMAND} ARGS -E copy_if_different ${HDF5_TEST_DIR}/${h5_file} $ {dest} ) ENDFOREACH ( h5_file ${HDF5_REFERENCE_TEST_FILES} ) Unfortunately it runs every time cmake is run but is still pretty quick since after the first time it doesn't really copy anything. _ Mike Jackson mike.jack...@bluequartz.net BlueQuartz Softwarewww.bluequartz.net Principal Software Engineer Dayton, Ohio On Jan 30, 2009, at 8:00 AM, Jonatan Bijl wrote: I have created an out-of-source build tree (on Windows), with the installation directory as a subfolder of the build trees. The idea is that the compiled binary requires some DLL's, images, 3D models and configuration files, at a location relative to the executable. If the files are changed, they will be copied from the source tree to the installation tree again. Therefore, I need to run "make install all" before running the executable. Because of the executable's dependency on the other files, I always want to build and install. (I don't expect a built file to work in itself because it won't be able to find the required files) In such a situation I usually try to "configure_file" things into the build tree such that I can run the executable from the build tree. Also setting EXECUTABLE_OUTPUT_PATH and LIBRARY_OUTPUT_PATH for this purpose is very useful. If I need to configure some files differently for the build and install tree, I configure them twice into separate directories (the latter e.g. under ${CMAKE_BINARY_DIR}/InstallFiles). This way I can have different versions of the configured files for the build and install tree. I have now set up the tree so that the executables can be run immediately from where they are created. I use configure_file to copy the files. The problem is now, that every time I do a re-configure, the files (including a dll that is very big) are copied. Is there a way of making sure the files are copied *only* when they are renewed? (and also making sure they are removed when the original is removed?) Here is my layout of the project: My setup is as follows: Src //the root of the cmake project +- Bin | Main.cxx + Lib | All other cxx and h files I made +- Data | Required files (3d models, images, etc.) +- Cfg Required config files Debug //all contents over here is generated by cmake-gui ../src and make +- Bin | Main.exe | DLLs of 3rd party library +- Lib | Compiled libXXX.a files +- Data | Required files (3d models, images, etc.) +- Cfg Required config files Thirdparty //this directory provides the 3rd party libraries we link | // against or include +- Cxxtest +- OgreSDK +- Bin | +- Debug | | All the DLL's | +- Release | All the DLL's +- Lib Include - This e-mail is intended exclusively for the addressee. If you are not the addressee you must not read, copy, use or disclose the e-mail nor the content; please notify us immediately [by clicking 'Reply'] and delete this e-mail. ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Using Eclipse CDT, CMake resets Eclipse project configuration frequently
>> I have created an out-of-source build tree (on Windows), with the >> installation directory as a subfolder of the build trees. The idea is >> that the compiled binary requires some DLL's, images, 3D models and >> configuration files, at a location relative to the executable. If the >> files are changed, they will be copied from the source tree to the >> installation tree again. Therefore, I need to run "make install all" >> before running the executable. Because of the executable's >> dependency on >> the other files, I always want to build and install. (I don't expect a >> built file to work in itself because it won't be able to find the >> required files) > > >In such a situation I usually try to "configure_file" things into the >build tree such that I can run the executable from the build tree. >Also setting EXECUTABLE_OUTPUT_PATH and LIBRARY_OUTPUT_PATH for this >purpose is very useful. If I need to configure some files differently >for the build and install tree, I configure them twice into separate >directories (the latter e.g. under ${CMAKE_BINARY_DIR}/InstallFiles). >This way I can have different versions of the configured files for the >build and install tree. > I have now set up the tree so that the executables can be run immediately from where they are created. I use configure_file to copy the files. The problem is now, that every time I do a re-configure, the files (including a dll that is very big) are copied. Is there a way of making sure the files are copied *only* when they are renewed? (and also making sure they are removed when the original is removed?) Here is my layout of the project: My setup is as follows: Src //the root of the cmake project +- Bin | Main.cxx + Lib | All other cxx and h files I made +- Data | Required files (3d models, images, etc.) +- Cfg Required config files Debug //all contents over here is generated by cmake-gui ../src and make +- Bin | Main.exe | DLLs of 3rd party library +- Lib | Compiled libXXX.a files +- Data | Required files (3d models, images, etc.) +- Cfg Required config files Thirdparty //this directory provides the 3rd party libraries we link | // against or include +- Cxxtest +- OgreSDK +- Bin | +- Debug | | All the DLL's | +- Release | All the DLL's +- Lib Include - This e-mail is intended exclusively for the addressee. If you are not the addressee you must not read, copy, use or disclose the e-mail nor the content; please notify us immediately [by clicking 'Reply'] and delete this e-mail. ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Using Eclipse CDT, CMake resets Eclipse project configuration frequently
My personal suggestion would be to use the plain MakeFiles generator and then inside eclipse create a "C++ Makefile" project. You can then point the project settings at the build directory to find the makefile and also tell eclipse to use "make all install" as the build command instead of plain "make". Then implement everything that was suggested below. You should be able to create the CMake file in such a way as to have all the needed files to run your application from the build tree. _ Mike Jackson mike.jack...@bluequartz.net BlueQuartz Softwarewww.bluequartz.net Principal Software Engineer Dayton, Ohio On Jan 26, 2009, at 7:22 AM, Michael Wild wrote: On 26. Jan, 2009, at 12:24, Jonatan Bijl wrote: Hi, I have created an out-of-source build tree (on Windows), with the installation directory as a subfolder of the build trees. The idea is that the compiled binary requires some DLL's, images, 3D models and configuration files, at a location relative to the executable. If the files are changed, they will be copied from the source tree to the installation tree again. Therefore, I need to run "make install all" before running the executable. Because of the executable's dependency on the other files, I always want to build and install. (I don't expect a built file to work in itself because it won't be able to find the required files) In such a situation I usually try to "configure_file" things into the build tree such that I can run the executable from the build tree. Also setting EXECUTABLE_OUTPUT_PATH and LIBRARY_OUTPUT_PATH for this purpose is very useful. If I need to configure some files differently for the build and install tree, I configure them twice into separate directories (the latter e.g. under ${CMAKE_BINARY_DIR}/ InstallFiles). This way I can have different versions of the configured files for the build and install tree. However, sometimes the project settings are reset (I guess they are re-generated by cmake), so that I have to manually set it to do "make install all" again instead of "make all". Does anyone know a way to enforce the install after every build? Or does anyone know a better way to make sure all the required files are updated from the src to the build tree if necessary? As I said, configure_file does the job. If the original file changed, the process will be repeated. If you only need to copy a certain file, you can use the COPY_ONLY option. HTH Michael ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Using Eclipse CDT, CMake resets Eclipse project configuration frequently
On 26. Jan, 2009, at 12:24, Jonatan Bijl wrote: Hi, I have created an out-of-source build tree (on Windows), with the installation directory as a subfolder of the build trees. The idea is that the compiled binary requires some DLL's, images, 3D models and configuration files, at a location relative to the executable. If the files are changed, they will be copied from the source tree to the installation tree again. Therefore, I need to run "make install all" before running the executable. Because of the executable's dependency on the other files, I always want to build and install. (I don't expect a built file to work in itself because it won't be able to find the required files) In such a situation I usually try to "configure_file" things into the build tree such that I can run the executable from the build tree. Also setting EXECUTABLE_OUTPUT_PATH and LIBRARY_OUTPUT_PATH for this purpose is very useful. If I need to configure some files differently for the build and install tree, I configure them twice into separate directories (the latter e.g. under ${CMAKE_BINARY_DIR}/InstallFiles). This way I can have different versions of the configured files for the build and install tree. However, sometimes the project settings are reset (I guess they are re-generated by cmake), so that I have to manually set it to do "make install all" again instead of "make all". Does anyone know a way to enforce the install after every build? Or does anyone know a better way to make sure all the required files are updated from the src to the build tree if necessary? As I said, configure_file does the job. If the original file changed, the process will be repeated. If you only need to copy a certain file, you can use the COPY_ONLY option. HTH Michael ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
[CMake] Using Eclipse CDT, CMake resets Eclipse project configuration frequently
Hi, I have created an out-of-source build tree (on Windows), with the installation directory as a subfolder of the build trees. The idea is that the compiled binary requires some DLL's, images, 3D models and configuration files, at a location relative to the executable. If the files are changed, they will be copied from the source tree to the installation tree again. Therefore, I need to run "make install all" before running the executable. Because of the executable's dependency on the other files, I always want to build and install. (I don't expect a built file to work in itself because it won't be able to find the required files) However, sometimes the project settings are reset (I guess they are re-generated by cmake), so that I have to manually set it to do "make install all" again instead of "make all". Does anyone know a way to enforce the install after every build? Or does anyone know a better way to make sure all the required files are updated from the src to the build tree if necessary? My layout is as follows: Src Source code directory tree Debug Debug-configured CDT project, which links to the src Debug/installation Installation directory (all required files, dlls and binaries are copied here) ReleaseRelease-configured CDT project, which links to the src Release/installation Installation directory (all required files, dlls and binaries are copied here) Jonatan - This e-mail is intended exclusively for the addressee. If you are not the addressee you must not read, copy, use or disclose the e-mail nor the content; please notify us immediately [by clicking 'Reply'] and delete this e-mail. ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake