[CMake] [PATCH] New FindIconv module
Attached is a patch that will find the iconv library by testing to make sure it exists by compiling a sample C file. Thank you, Steven N. Oliver 0001-Add-new-FindIconv-module.patch Description: Binary data -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
[CMake] Bug in find_file() command ?
I need to test for the presence of a directory called driver_root. I couldn't see a find_directory() command in the help so I am using the following lines in my CMakeLists.txt: message("1 DRV_ROOT_CHECK: ${DRV_ROOT_CHECK}") if (DEFINED ENV{DRV_ROOT}) find_file(DRV_ROOT_CHECK driver_root $ENV{DRV_ROOT}/..) message("2 DRV_ROOT_CHECK: ${DRV_ROOT_CHECK}") endif() message("3 DRV_ROOT_CHECK: ${DRV_ROOT_CHECK}") find_file(DRV_ROOT_CHECK driver_root ../CVSFILES ../.. ../../CVSFILES ../../.. ../../../CVSFILES ../../../.. ) message("4 DRV_ROOT_CHECK: ${DRV_ROOT_CHECK}") set(DRV_ROOT "${DRV_ROOT_CHECK}" CACHE PATH "Location of driver tree") set(DRV_ROOT_CHECK "${DRV_ROOT_CHECK}" CACHE INTERNAL "Location of driver tree") message("5 DRV_ROOT_CHECK: ${DRV_ROOT_CHECK}") if (DRV_ROOT_CHECK) message(" DRV_ROOT: ${DRV_ROOT}") else() message(FATAL_ERROR "Unable to locate driver_root directory. Please set DRV_ROOT variable.") endif() It works fine on my machine but fails on one of our build machines. Both machines are Windows 7 (64-bit) and are using CMake 2.8.9. On my machine it produces this output: 1 DRV_ROOT_CHECK: 3 DRV_ROOT_CHECK: 4 DRV_ROOT_CHECK: C:/data/perforceCheckouts/sim/vxe/CVSFILES/driver_root 5 DRV_ROOT_CHECK: C:/data/perforceCheckouts/sim/vxe/CVSFILES/driver_root DRV_ROOT: C:/data/perforceCheckouts/sim/vxe/CVSFILES/driver_root but on the build machine it produces this output: 1 DRV_ROOT_CHECK: 3 DRV_ROOT_CHECK: 4 DRV_ROOT_CHECK: C:/Windows/System32/driver_root 5 DRV_ROOT_CHECK: C:/Windows/System32/driver_root There is no file or directory called driver_root in the windows/systsem32 folder. If I change the find_file() command to this: find_file(DRV_ROOT_CHECK driver_root PATHS ../CVSFILES ../.. ../../CVSFILES ../../.. ../../../CVSFILES ../../../.. NO_DEFAULT_PATH ) then it works producing this output: 1 DRV_ROOT_CHECK: 3 DRV_ROOT_CHECK: 4 DRV_ROOT_CHECK: C:/glenn/CVSFILES/driver_root 5 DRV_ROOT_CHECK: C:/glenn/CVSFILES/driver_root Is this a bug in cmake or can somebody explain how it found a non-existant file/folder in the windows/system32 folder ? -- Glenn -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Add header files to project when there are no cpp files
> Not sure if it works with QtCreator or not, but you should be able to > add_custom_target and use the SOURCES argument to get "source" files > to show up in the generated project. Ah, thanks. I had tried: add_custom_target(MyProject MyProject.h) but not: add_custom_target(MyProject SOURCES MyProject.h) It does do the trick for QtCreator. Thanks, David -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Add header files to project when there are no cpp files
On Tue, Aug 28, 2012 at 10:01 AM, David Doria wrote: > I have just started using QtCreator. When I open a CMake project in > QtCreator, all of my cpp files mentioned in the CMakeLists.txt are added to > the "project". However, my headers (.h) and template implementation (.hpp) > are not added to the project (I believe this is the same behavior as Visual > Studio). I have seen this thread: > http://www.cmake.org/pipermail/cmake/2003-January/003274.html that says you > can simply add the headers to the add_executable/add_library line: > > add_library(MyProject main.cpp MyClass.h MyClass.cpp) > > This works fine. However, I have several projects that are "template only" > (there are no .cpp files), and I essentially only use them as git > submodules, so there are actually no driver cpp files either (the drivers > are in the project that includes the submodule). That is, the complete > directory looks like this: > > MyProject/CMakeLists.txt > MyProject/MyProject.h > > Because of this, I can't use add_executable or add_library at all. Is there > another command that can get CMake to add these files to the project? > > Thanks, > > David > > -- > > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Follow this link to subscribe/unsubscribe: > http://www.cmake.org/mailman/listinfo/cmake Not sure if it works with QtCreator or not, but you should be able to add_custom_target and use the SOURCES argument to get "source" files to show up in the generated project. -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Different handling of spaces in COMPILE_FLAGS on Windows XP
On Mon, Aug 27, 2012 at 2:37 PM, Robert Dailey wrote: > I'm seeing different results here between Windows 7 and Windows XP. > Here is the CMake code I use to add /FI (force includes) to the > compiler flags for a source file: > > function( _force_include header_file ) > if( MSVC ) > foreach( source ${ARGN} ) > get_filename_component( ext ${source} EXT ) > if( ext STREQUAL ".cpp" ) > set_property( SOURCE ${source} APPEND_STRING > PROPERTY > COMPILE_FLAGS "/FI${header_file} " > ) > endif() > endforeach() > else() > message( SEND_ERROR "_force_include() not implemented on this > platform" ) > endif() > endfunction() > > Here is the Visual Studio 2008 vcproj output on XP: > > AdditionalOptions=" and > Settings/superpc/dev/DominoProcessDecompCMake/cmake/files/source/hash_map_hack.hpp" > ForcedIncludeFiles="C:/Documents" > > And on Windows 7 it is: > > ForcedIncludeFiles="C:/Documents and > Settings/superpc/dev/DominoProcessDecompCMake/cmake/files/source/hash_map_hack.hpp" > > Any reason why I'm getting different results on XP vs W7? I'm running > CMake 2.8.9 on both platforms with the same CMake scripts & code. > -- > > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Follow this link to subscribe/unsubscribe: > http://www.cmake.org/mailman/listinfo/cmake Something *ELSE* must also be different. I don't think we have code that should generate different VC output files for the same version of VC on Windows XP and Windows 7. (It's possible, but I consider it highly unlikely.) Is there a service pack level difference? Something in the environment? Can you track it down in the CMake source code to something that would logically be different between XP and 7? -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
[CMake] Add header files to project when there are no cpp files
I have just started using QtCreator. When I open a CMake project in QtCreator, all of my cpp files mentioned in the CMakeLists.txt are added to the "project". However, my headers (.h) and template implementation (.hpp) are not added to the project (I believe this is the same behavior as Visual Studio). I have seen this thread: http://www.cmake.org/pipermail/cmake/2003-January/003274.html that says you can simply add the headers to the add_executable/add_library line: add_library(MyProject main.cpp MyClass.h MyClass.cpp) This works fine. However, I have several projects that are "template only" (there are no .cpp files), and I essentially only use them as git submodules, so there are actually no driver cpp files either (the drivers are in the project that includes the submodule). That is, the complete directory looks like this: MyProject/CMakeLists.txt MyProject/MyProject.h Because of this, I can't use add_executable or add_library at all. Is there another command that can get CMake to add these files to the project? Thanks, David -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake