Re: [CMake] Dependency scanning for non-supported languages?
I got it working, thanks! Turns out that whenever my dependency generator changes the deps file, CMake notices this fact (because the file is included) and does a reconfigure anyway. So all I have to do is make and everything works. Sweet! In case you are interested, here's what I did: The dependency file generator creates a dependency entry for each target in the library: set(TART_TESTING_ASSERTS_DEPS /home/talin/Projects/tart/trunk/stdlib/tart/core/AssertionFailureException.tart /home/talin/Projects/tart/trunk/stdlib/tart/core/Debug.tart /home/talin/Projects/tart/trunk/stdlib/tart/core/Iterable.tart /home/talin/Projects/tart/trunk/stdlib/tart/core/String.tart ) set(TART_TESTING_TEST_DEPS /home/talin/Projects/tart/trunk/libtesting/tart/testing/Asserts.tart /home/talin/Projects/tart/trunk/stdlib/tart/core/Debug.tart /home/talin/Projects/tart/trunk/stdlib/tart/core/Throwable.tart /home/talin/Projects/tart/trunk/stdlib/tart/reflect/ComplexType.tart /home/talin/Projects/tart/trunk/stdlib/tart/reflect/Method.tart /home/talin/Projects/tart/trunk/stdlib/tart/reflect/Type.tart ) The name of the variable is generated by taking the target name, replacing all '/' with '_', and then converting to upper case. So tart/testing/Test.tart becomes TART_TESTING_TEST_DEPS. I then import the dependency file in my CMakeLists.txt: include(${CMAKE_CURRENT_BINARY_DIR}/libtesting.deps OPTIONAL) For each target, I generate the name of the variable that contains the deps for that target, using the same algorithm as used in the generator program: # Generate the deps variable name string(REGEX REPLACE .tart\$ DEPS_NAME ${SRC_FILE}) string(TOUPPER ${DEPS_NAME} DEPS_NAME) string(REGEX REPLACE [^a-zA-Z0-9] _ DEPS_NAME ${DEPS_NAME}) And then use recursive variable expansion to make the deps name a dependency of the target: DEPENDS ${SRC_FILE} tartc ${${DEPS_NAME}_DEPS} Finally, at the end of the CMakeLists.txt, I invoke the dependency generator program to generate the new deps file for the next build: # Generate dependency info add_custom_command( OUTPUT libtesting.deps COMMAND gendeps -o libtesting.deps ${TESTING_BC_FILES} DEPENDS ${TESTING_BC_FILES} gendeps COMMENT Generating dependencies for libtesting.bc) CMake will notice that the date stamp has changed and reconfigure next time I run make. One final touch I want to make is to not change the date stamp on the output file unless the contents have changed. On Wed, Dec 30, 2009 at 7:11 PM, Alan W. Irwin ir...@beluga.phys.uvic.cawrote: On 2009-12-30 12:30-0800 Talin wrote: That is more along the lines of what I was looking for. Thanks! :) One further question: Using the technique you describe, the dependency file will need to be regenerated each time a source file changes - i.e. if I add a new import statement to a source file, the list of dependencies will change, which will require the dependency file to be rebuilt. Can that rebuild happen as part of the normal build, or can that only be done at CMake time? Good question. The dependency information is used by CMake (at CMake time) to configure a custom command to be run at build time with the correct dependencies. Thus, the answer to your question must be that build time is too late to collect the dependency information used by CMake. Instead, you must do that at CMake time like I outlined. Alan __ Alan W. Irwin Astronomical research affiliation with Department of Physics and Astronomy, University of Victoria (astrowww.phys.uvic.ca). Programming affiliations with the FreeEOS equation-of-state implementation for stellar interiors (freeeos.sf.net); PLplot scientific plotting software package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project (lbproject.sf.net). __ Linux-powered Science __ -- -- Talin ___ 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] Policy Scope Question
On Tuesday 29 December 2009, Richard Wackerbarth wrote: I have a question about policy CMP0011. I have: $ cat Call_process_dashboard.cmake # Call process_dashboard # These files are maintained by Richard Wackerbarth set(maintainer_email_account Richard) set(maintainer_email_domain NFSNet.org) IF(COMMAND CMAKE_POLICY) CMAKE_POLICY(SET CMP0011 NEW) ENDIF(COMMAND CMAKE_POLICY) process_dashboard (${project} ${branch}) $ From my reading of its definition, setting CMP0011 to NEW should suppress all complaints about changes to policy in any subordinate scopes. Thus shouldn't any policy changes make within process_dashboard() be OK and not generate any warning? What warnings do you get ? Alex ___ 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] restricting Qt include and library linking to 1 library/project
Hello, My toplevel CMakeLists.txt looks like: PROJECT(...) CMAKE_MINIMUM_REQUIRED(VERSION 2.8) # Openmp FIND_PACKAGE(OpenMP) IF(OPENMP_FOUND) SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}) ENDIF() # Boost FIND_PACKAGE(Boost) IF(Boost_FOUND) INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) ENDIF() # Qt FIND_PACKAGE(Qt4 4.6.0 COMPONENTS QtCore QtGui QtOpenGL REQUIRED) INCLUDE(${QT_USE_FILE}) INCLUDE_DIRECTORIES(AFTER ${CMAKE_CURRENT_SOURCE_DIR}) ADD_SUBDIRECTORY(common) ADD_SUBDIRECTORY(lib1) ADD_SUBDIRECTORY(lib2) ADD_SUBDIRECTORY(lib3) ADD_SUBDIRECTORY(main) Using QT_USE_FILE includes Qt headers for all of common, lib1, lib2, lib3. How can I include and link Qt only for lib3? Lib3's CMakeLists.txt looks like: ADD_LIBRARY(lib3 STATIC #cpps hpps ipps) ADD_DEPENDENCIES(lib3 common) TARGET_LINK_LIBRARIES(lib3 ${QT_LIBRARIES}) Rds, ___ 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] restricting Qt include and library linking to 1 library/project
Hello, Do find_package( Qt4 COMPONENTS ... ) from each subdir and use only the components you need for each library. Do not INCLUDE( ${QT_USE_FILE} ) in any case, just do an include_directories. When linking, do not use the contain-all QT_LIBRARIES variable but the individual library variables. Assuming lib1 uses QtCore and QtNetwork: find_package( Qt4 COMPONENTS QtCore QtNetwork REQUIRED ) include_directories( ${QT_QTCORE_INCLUDE_DIR} ${QT_QTNETWORK_INCLUDE_DIR} ) add_library( lib1 SHARED lib1_source1.cpp lib1_source2.cpp ... ) target_link_libraries( lib1 ${QT_QTCORE_LIBRARIES} ${QT_QTNETWORK_LIBRARIES} ) You'd do similar for lib2 and lib3 and the main CMakeLists.txt would only contain something like: project( blah ) add_directory( lib1 ) add_directory( lib2 ) add_directory( lib3 ) i. e. no find_package( Qt4 ...) in the main CMakeLists.txt [*] [*] Actually you can do the find_package( Qt4 COMPONENTES yourcomponents ) in the main CMakeLists.txt but then you need to specify all the components required by all the directories below that one in the hierarchy, which is more difficult to track. On Thu, Dec 31, 2009 at 2:45 PM, Hicham Mouline hic...@mouline.org wrote: Hello, My toplevel CMakeLists.txt looks like: PROJECT(...) CMAKE_MINIMUM_REQUIRED(VERSION 2.8) # Openmp FIND_PACKAGE(OpenMP) IF(OPENMP_FOUND) SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}) ENDIF() # Boost FIND_PACKAGE(Boost) IF(Boost_FOUND) INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) ENDIF() # Qt FIND_PACKAGE(Qt4 4.6.0 COMPONENTS QtCore QtGui QtOpenGL REQUIRED) INCLUDE(${QT_USE_FILE}) INCLUDE_DIRECTORIES(AFTER ${CMAKE_CURRENT_SOURCE_DIR}) ADD_SUBDIRECTORY(common) ADD_SUBDIRECTORY(lib1) ADD_SUBDIRECTORY(lib2) ADD_SUBDIRECTORY(lib3) ADD_SUBDIRECTORY(main) Using QT_USE_FILE includes Qt headers for all of common, lib1, lib2, lib3. How can I include and link Qt only for lib3? Lib3's CMakeLists.txt looks like: ADD_LIBRARY(lib3 STATIC #cpps hpps ipps) ADD_DEPENDENCIES(lib3 common) TARGET_LINK_LIBRARIES(lib3 ${QT_LIBRARIES}) Rds, ___ 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 -- Pau Garcia i Quiles http://www.elpauer.org (Due to my workload, I may need 10 days to answer) ___ 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] restricting Qt include and library linking to 1 library/project
-Original Message- From: Pau Garcia i Quiles [mailto:pgqui...@elpauer.org] Sent: 31 December 2009 14:07 To: Hicham Mouline Cc: cmake@cmake.org Subject: Re: [CMake] restricting Qt include and library linking to 1 library/project Hello, Do find_package( Qt4 COMPONENTS ... ) from each subdir and use only the components you need for each library. Do not INCLUDE( ${QT_USE_FILE} ) in any case, just do an include_directories. When linking, do not use the contain-all QT_LIBRARIES variable but the individual library variables. Assuming lib1 uses QtCore and QtNetwork: find_package( Qt4 COMPONENTS QtCore QtNetwork REQUIRED ) include_directories( ${QT_QTCORE_INCLUDE_DIR} ${QT_QTNETWORK_INCLUDE_DIR} ) add_library( lib1 SHARED lib1_source1.cpp lib1_source2.cpp ... ) target_link_libraries( lib1 ${QT_QTCORE_LIBRARIES} ${QT_QTNETWORK_LIBRARIES} ) Does this take care of both release and debug libraries? Ie, in release build, it will include release libs and in debug debug libs? Thanks for this, ___ 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] restricting Qt include and library linking to 1 library/project
On Thu, Dec 31, 2009 at 4:06 PM, Hicham Mouline hic...@mouline.org wrote: Assuming lib1 uses QtCore and QtNetwork: find_package( Qt4 COMPONENTS QtCore QtNetwork REQUIRED ) include_directories( ${QT_QTCORE_INCLUDE_DIR} ${QT_QTNETWORK_INCLUDE_DIR} ) add_library( lib1 SHARED lib1_source1.cpp lib1_source2.cpp ... ) target_link_libraries( lib1 ${QT_QTCORE_LIBRARIES} ${QT_QTNETWORK_LIBRARIES} ) Does this take care of both release and debug libraries? Ie, in release build, it will include release libs and in debug debug libs? Yes, it does. Take a look at FindQt4.cmake for the details. -- Pau Garcia i Quiles http://www.elpauer.org (Due to my workload, I may need 10 days to answer) ___ 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] restricting Qt include and library linking to 1 library/project
If you have multiple directories with different Qt dependencies, you can do: find_package(Qt4 REQUIRED) in the top directory, then each sub directory can do something like set(QT_USE_QTOPENGL 1) include(${QT_USE_FILE}) But in your case, its only lib3, so just do it in that CMakeLists.txt file. Clint On Dec 31, 2009, at 6:45 AM, Hicham Mouline wrote: Hello, My toplevel CMakeLists.txt looks like: PROJECT(...) CMAKE_MINIMUM_REQUIRED(VERSION 2.8) # Openmp FIND_PACKAGE(OpenMP) IF(OPENMP_FOUND) SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}) ENDIF() # Boost FIND_PACKAGE(Boost) IF(Boost_FOUND) INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) ENDIF() # Qt FIND_PACKAGE(Qt4 4.6.0 COMPONENTS QtCore QtGui QtOpenGL REQUIRED) INCLUDE(${QT_USE_FILE}) INCLUDE_DIRECTORIES(AFTER ${CMAKE_CURRENT_SOURCE_DIR}) ADD_SUBDIRECTORY(common) ADD_SUBDIRECTORY(lib1) ADD_SUBDIRECTORY(lib2) ADD_SUBDIRECTORY(lib3) ADD_SUBDIRECTORY(main) Using QT_USE_FILE includes Qt headers for all of common, lib1, lib2, lib3. How can I include and link Qt only for lib3? Lib3's CMakeLists.txt looks like: ADD_LIBRARY(lib3 STATIC #cpps hpps ipps) ADD_DEPENDENCIES(lib3 common) TARGET_LINK_LIBRARIES(lib3 ${QT_LIBRARIES}) Rds, ___ 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 ___ 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] Policy Scope Question
Checking Project CMake/2_8. Running Dashboard for CMake/2_8. Problem opening /proc/cpuinfo Problem opening /proc/cpuinfo Problem opening /proc/cpuinfo CMake Warning (dev) at Dashboards/Scripts/Possibly_Run_Dashboard.cmake:14 (include): Policy CMP0011 is not set: Included scripts do automatic cmake_policy PUSH and POP. Run cmake --help-policy CMP0011 for policy details. Use the cmake_policy command to set the policy and suppress this warning. The included script /home/dashboard/Dashboards/Scripts/Run_Dashboard.cmake affects policy settings. CMake is implying the NO_POLICY_SCOPE option for compatibility, so the effects are applied to the including context. Call Stack (most recent call first): Dashboards/Scripts/GenericFunctions.cmake:77 (include) Dashboards/Scripts/Call_process_dashboard.cmake:11 (process_dashboard) Dashboards/Scripts/GenericFunctions.cmake:19 (include) Dashboards/Scripts/AutoStart.cmake:21 (do_all) This warning is for project developers. Use -Wno-dev to suppress it. CMake Warning (dev) at Dashboards/Scripts/GenericFunctions.cmake:77 (include): Policy CMP0011 is not set: Included scripts do automatic cmake_policy PUSH and POP. Run cmake --help-policy CMP0011 for policy details. Use the cmake_policy command to set the policy and suppress this warning. The included script /home/dashboard/Dashboards/Scripts/Possibly_Run_Dashboard.cmake affects policy settings. CMake is implying the NO_POLICY_SCOPE option for compatibility, so the effects are applied to the including context. Call Stack (most recent call first): Dashboards/Scripts/Call_process_dashboard.cmake:11 (process_dashboard) Dashboards/Scripts/GenericFunctions.cmake:19 (include) Dashboards/Scripts/AutoStart.cmake:21 (do_all) This warning is for project developers. Use -Wno-dev to suppress it. Checking Project CMake/2_9. On Dec 31, 2009, at 6:57 AM, Alexander Neundorf wrote: On Tuesday 29 December 2009, Richard Wackerbarth wrote: I have a question about policy CMP0011. I have: $ cat Call_process_dashboard.cmake # Call process_dashboard # These files are maintained by Richard Wackerbarth set(maintainer_email_account Richard) set(maintainer_email_domain NFSNet.org) IF(COMMAND CMAKE_POLICY) CMAKE_POLICY(SET CMP0011 NEW) ENDIF(COMMAND CMAKE_POLICY) process_dashboard (${project} ${branch}) $ From my reading of its definition, setting CMP0011 to NEW should suppress all complaints about changes to policy in any subordinate scopes. Thus shouldn't any policy changes make within process_dashboard() be OK and not generate any warning? What warnings do you get ? Alex ___ 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] Policy Scope Question
If you do cmake_minimum_required to something less than 2.8, then that call will reset any policies you have set at the outer level... So, to really use a NEW value for policy CMP0011, you have to do it *after* the last cmake_minimum_required or update your min required to 2.8... On Thu, Dec 31, 2009 at 11:30 AM, Richard Wackerbarth rich...@nfsnet.orgwrote: Checking Project CMake/2_8. Running Dashboard for CMake/2_8. Problem opening /proc/cpuinfo Problem opening /proc/cpuinfo Problem opening /proc/cpuinfo CMake Warning (dev) at Dashboards/Scripts/Possibly_Run_Dashboard.cmake:14 (include): Policy CMP0011 is not set: Included scripts do automatic cmake_policy PUSH and POP. Run cmake --help-policy CMP0011 for policy details. Use the cmake_policy command to set the policy and suppress this warning. The included script /home/dashboard/Dashboards/Scripts/Run_Dashboard.cmake affects policy settings. CMake is implying the NO_POLICY_SCOPE option for compatibility, so the effects are applied to the including context. Call Stack (most recent call first): Dashboards/Scripts/GenericFunctions.cmake:77 (include) Dashboards/Scripts/Call_process_dashboard.cmake:11 (process_dashboard) Dashboards/Scripts/GenericFunctions.cmake:19 (include) Dashboards/Scripts/AutoStart.cmake:21 (do_all) This warning is for project developers. Use -Wno-dev to suppress it. CMake Warning (dev) at Dashboards/Scripts/GenericFunctions.cmake:77 (include): Policy CMP0011 is not set: Included scripts do automatic cmake_policy PUSH and POP. Run cmake --help-policy CMP0011 for policy details. Use the cmake_policy command to set the policy and suppress this warning. The included script /home/dashboard/Dashboards/Scripts/Possibly_Run_Dashboard.cmake affects policy settings. CMake is implying the NO_POLICY_SCOPE option for compatibility, so the effects are applied to the including context. Call Stack (most recent call first): Dashboards/Scripts/Call_process_dashboard.cmake:11 (process_dashboard) Dashboards/Scripts/GenericFunctions.cmake:19 (include) Dashboards/Scripts/AutoStart.cmake:21 (do_all) This warning is for project developers. Use -Wno-dev to suppress it. Checking Project CMake/2_9. On Dec 31, 2009, at 6:57 AM, Alexander Neundorf wrote: On Tuesday 29 December 2009, Richard Wackerbarth wrote: I have a question about policy CMP0011. I have: $ cat Call_process_dashboard.cmake # Call process_dashboard # These files are maintained by Richard Wackerbarth set(maintainer_email_account Richard) set(maintainer_email_domain NFSNet.org) IF(COMMAND CMAKE_POLICY) CMAKE_POLICY(SET CMP0011 NEW) ENDIF(COMMAND CMAKE_POLICY) process_dashboard (${project} ${branch}) $ From my reading of its definition, setting CMP0011 to NEW should suppress all complaints about changes to policy in any subordinate scopes. Thus shouldn't any policy changes make within process_dashboard() be OK and not generate any warning? What warnings do you get ? Alex ___ 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 ___ 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] restricting Qt include and library linking to 1 library/project
-Original Message- From: Clinton Stimpson [mailto:clin...@elemtech.com] Sent: 31 December 2009 16:08 To: Hicham Mouline Cc: cmake@cmake.org Subject: Re: [CMake] restricting Qt include and library linking to 1 library/project If you have multiple directories with different Qt dependencies, you can do: find_package(Qt4 REQUIRED) in the top directory, then each sub directory can do something like set(QT_USE_QTOPENGL 1) include(${QT_USE_FILE}) But in your case, its only lib3, so just do it in that CMakeLists.txt file. Clint That's what I did at the end. I did this: FIND_PACKAGE(Qt4 4.6.0 COMPONENTS QtCore QtGui QtOpenGL REQUIRED) INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR} ${QT_QTGUI_INCLUDE_DIR}) MESSAGE(STATUS QT_QTCORE_LIBRARY=${QT_QTCORE_LIBRARY}) TARGET_LINK_LIBRARIES(plot $QT_QTCORE_LIBRARY) The include dirs are set correctly, but I'm having trouble with QT_QTCORE_LIBRARY. This appears as : QT_QTCORE_LIBRARY=optimized;C:/Progra~2/Qt/4.6.0/lib/QtCore4.lib;debug;C:/Pr ogra~2/Qt/4.6.0/lib/QtCored4.lib When I open the solution with vs2008, the Librarian doesn't show this libraries as input. Note the help for TARGET_LINK_LIBRARIES displays the syntax as: target_link_libraries(target [item1 [item2 [...]]] [[debug|optimized|general] item] ...) There are no semicolons after the optimized|debug keywords, I wonder if by not using QT_USE_FILE, QT_QTCORE_LIBRARY are others are set incorrecty. Rds, ___ 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] restricting Qt include and library linking to 1 library/project
On Thu, Dec 31, 2009 at 3:12 PM, Hicham Mouline hic...@mouline.org wrote: -Original Message- From: Clinton Stimpson [mailto:clin...@elemtech.com] Sent: 31 December 2009 16:08 To: Hicham Mouline Cc: cmake@cmake.org Subject: Re: [CMake] restricting Qt include and library linking to 1 library/project If you have multiple directories with different Qt dependencies, you can do: find_package(Qt4 REQUIRED) in the top directory, then each sub directory can do something like set(QT_USE_QTOPENGL 1) include(${QT_USE_FILE}) But in your case, its only lib3, so just do it in that CMakeLists.txt file. Clint That's what I did at the end. I did this: FIND_PACKAGE(Qt4 4.6.0 COMPONENTS QtCore QtGui QtOpenGL REQUIRED) INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR} ${QT_QTGUI_INCLUDE_DIR}) MESSAGE(STATUS QT_QTCORE_LIBRARY=${QT_QTCORE_LIBRARY}) TARGET_LINK_LIBRARIES(plot $QT_QTCORE_LIBRARY) The include dirs are set correctly, but I'm having trouble with QT_QTCORE_LIBRARY. This appears as : QT_QTCORE_LIBRARY=optimized;C:/Progra~2/Qt/4.6.0/lib/QtCore4.lib;debug;C:/Pr ogra~2/Qt/4.6.0/lib/QtCored4.lib When I open the solution with vs2008, the Librarian doesn't show this libraries as input. Note the help for TARGET_LINK_LIBRARIES displays the syntax as: target_link_libraries(target [item1 [item2 [...]]] [[debug|optimized|general] item] ...) There are no semicolons after the optimized|debug keywords, I wonder if by not using QT_USE_FILE, QT_QTCORE_LIBRARY are others are set incorrecty. If you open cmake-gui does and look at the Qt tab in Grouped View are the debug libraries properly set? John ___ 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] restricting Qt include and library linking to 1 library/project
If you open cmake-gui does and look at the Qt tab in Grouped View are the debug libraries properly set? Hmm sorry for the bad wording.. If you open cmake-gui and look at the Qt tab in Grouped View are the debug libraries properly set? John ___ 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] restricting Qt include and library linking to 1 library/project
On Dec 31, 2009, at 1:12 PM, Hicham Mouline wrote: -Original Message- From: Clinton Stimpson [mailto:clin...@elemtech.com] Sent: 31 December 2009 16:08 To: Hicham Mouline Cc: cmake@cmake.org Subject: Re: [CMake] restricting Qt include and library linking to 1 library/project If you have multiple directories with different Qt dependencies, you can do: find_package(Qt4 REQUIRED) in the top directory, then each sub directory can do something like set(QT_USE_QTOPENGL 1) include(${QT_USE_FILE}) But in your case, its only lib3, so just do it in that CMakeLists.txt file. Clint That's what I did at the end. I did this: FIND_PACKAGE(Qt4 4.6.0 COMPONENTS QtCore QtGui QtOpenGL REQUIRED) INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR} ${QT_QTGUI_INCLUDE_DIR}) MESSAGE(STATUS QT_QTCORE_LIBRARY=${QT_QTCORE_LIBRARY}) TARGET_LINK_LIBRARIES(plot $QT_QTCORE_LIBRARY) The include dirs are set correctly, but I'm having trouble with QT_QTCORE_LIBRARY. This appears as : QT_QTCORE_LIBRARY=optimized;C:/Progra~2/Qt/4.6.0/lib/QtCore4.lib;debug;C:/Pr ogra~2/Qt/4.6.0/lib/QtCored4.lib When I open the solution with vs2008, the Librarian doesn't show this libraries as input. Note the help for TARGET_LINK_LIBRARIES displays the syntax as: target_link_libraries(target [item1 [item2 [...]]] [[debug|optimized|general] item] ...) There are no semicolons after the optimized|debug keywords, I wonder if by not using QT_USE_FILE, QT_QTCORE_LIBRARY are others are set incorrecty. Rds, You probably meant ${QT_QTCORE_LIBRARY} instead of $QT_CORE_LIBRARY What about this: find_package(Qt4 4.6.0 COMPONENTS QtCore QtGui QtOpenGL REQUIRED) include(${QT_USE_FILE}) ... target_link_libraries(plot ${QT_LIBRARIES}) The file pointed to by QT_USE_FILE sets up the current directory with include directories and compile flags and sets up QT_LIBRARIES for the chosen components. You can do it on your own, but its more work. Clint ___ 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] getting undefined error to my own libs.
ok, solved, move array implementation into the header and found the missing module in boost. On Tue 29 Dec 19:18 2009 e...@cs.bgu.ac.il wrote: how much can this bloat my executable? On Tue 29 Dec 19:16 2009 aaron_wri...@selinc.com wrote: With templates it's easiest to declare and implement in one file. The compiler likes this. Anything else you try requires extra work. Unless you're working in an embedded environment I don't see how executable size should even be a concern. - Aaron Wright e...@cs.bgu.ac.il e...@cs.bgu.ac.il 12/29/2009 09:11 AM To aaron_wri...@selinc.com cc cmake@cmake.org Subject Re: [CMake] getting undefined error to my own libs. I'm trying to refrain from using that because it can bloat up the executable size... unless you can tell me otherwise. in general the program will be compiled using g++ for now, maybe I'll add support for windows compiler later. also, I'm trying to keep the definitions to the header files and the code to the src files. On Tue 29 Dec 18:59 2009 aaron_wri...@selinc.com wrote: Just put the implementation of the template class in the declaration. Get that to work, then try to get fancy if you want to. - Aaron Wright e...@cs.bgu.ac.il e...@cs.bgu.ac.il Sent by: cmake-boun...@cmake.org 12/29/2009 08:54 AM To Eric Noulard eric.noul...@gmail.com cc cmake@cmake.org Subject Re: [CMake] getting undefined error to my own libs. ok, I've read the links, let say I'm not use the export option, when I look at the how to avoid link errors here: http://www.parashift.com/c++-faq-lite/templates.html#faq-35.13[1] I see that what I've did is the same, isn't it? I'm not sure where to follow from here... if I've did what they say and I still get a undefined error, then I must have miss configured cmake. when I add extern to the deceleration in the header, I get this error: storage class specified for `Array` On Tue 29 Dec 17:16 2009 Eric Noulard wrote: 2009/12/29 e...@cs.bgu.ac.il e...@cs.bgu.ac.il: hello Eric, thanks for the response. I'd like to solve the Array issue first, then the boost because I have a feeling it is a different one because when I disable the relevant code it doesn't generates the error even when other parts of the program (such as the threadpool). here are the array files content: http://codepad.org/klDWMowB[2] I assume the content of the .hpp is between #ifndef CARRAY_HPP then the code is the .cpp file. The trouble comes from the fact that your class is a template one, so that the content of the .cpp file may not be compiled independently as-is because it must be instantiated first. I invite you to read this: http://www.parashift.com/c++-faq-lite/templates.html#faq-35.12[3] and may be this one too: http://corfield.org/index.cfm/event/cplusplus.section/section/ptexp[4] Note that the export keyword solution may not be a good one because many compilers do not implement it, beginning with gcc: http://gcc.gnu.org/bugs/#nonbugs_cxx[5] beside a strange typo that I've done, I don't thing I've miss configured it somehow. I think may be you did not played a lot with templated classes. (just a guess I may be wrong). Concerning this issue, I'm pretty sure this is not a CMake one. -- Erk Membre de l'April - « promouvoir et défendre le logiciel libre » - http://www.april.org[6] ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html[7] Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ[8] Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake[9] References: 1 : http://www.parashift.com/c++-faq-lite/templates.html#faq-35.13 2 : http://codepad.org/klDWMowB 3 : http://www.parashift.com/c++-faq-lite/templates.html#faq-35.12 4 : http://corfield.org/index.cfm/event/cplusplus.section/section/ptexp 5 : http://gcc.gnu.org/bugs/#nonbugs_cxx 6 : http://www.april.org/ 7 : http://www.kitware.com/opensource/opensource.html 8 : http://www.cmake.org/Wiki/CMake_FAQ 9 : http://www.cmake.org/mailman/listinfo/cmake ___ 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
[CMake] fltk and cmake get undefined reference.
hello, I have a program that uses fltk, I've defined the require part in cmakelist.txt but I still get undefined reference error, where are the file's content: http://pastebin.com/m113e3c48 how can I solve it? ___ 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] restricting Qt include and library linking to 1 library/project
On Thu, Dec 31, 2009 at 5:06 PM, Hicham Mouline hic...@mouline.org wrote: -Original Message- From: John Drescher [mailto:dresche...@gmail.com] Sent: 31 December 2009 20:25 To: Hicham Mouline; CMake mailing list Subject: Re: [CMake] restricting Qt include and library linking to 1 library/project If you open cmake-gui does and look at the Qt tab in Grouped View are the debug libraries properly set? Hmm sorry for the bad wording.. If you open cmake-gui and look at the Qt tab in Grouped View are the debug libraries properly set? John The _DEBUG and _RELEASE version of the cmake variables look properly set in cmake-gui Thanks I asked this because one time I forgot to build the debug version of Qt and cmake supplied the release versions of all the Qt libraries for my projects debug and release builds. John ___ 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] restricting Qt include and library linking to 1 library/project
-Original Message- From: Clinton Stimpson [mailto:clin...@elemtech.com] snip ADD_LIBRARY(plot STATIC ... ... ...) TARGET_LINK_LIBRARIES(plot C:/Progra~2/Qt/4.6.0/lib/QtCored4.lib) 1. from cmd dos: dir C:/Progra~2/Qt/4.6.0/lib/QtCored4.lib = nothing But dir C:\Progra~2\Qt\4.6.0\lib\QtCored4.lib = works 2. I tried all the following: TARGET_LINK_LIBRARIES(plot C:/Progra~2/Qt/4.6.0/lib/QtCored4.lib) TARGET_LINK_LIBRARIES(plot C:/Progra~2/Qt/4.6.0/lib/QtCored4.lib) Neither generates a plot.vcjproj containing this .lib at all TARGET_LINK_LIBRARIES(plot C:\Progra~2\Qt\4.6.0\lib\QtCored4.lib) TARGET_LINK_LIBRARIES(plot C:\Progra~2\Qt\4.6.0\lib\QtCored4.lib) Fail with a syntax error by cmake. I then tried FILE (TO_CMAKE_PATH C:\\Program Files (x86)\\Qt\\4.6.0\\lib\\QtCored4.lib MY_QTCORELIB) TARGET_LINK_LIBRARIES(plot MY_QTCORELIB) But still not QtCored4.lib in the vcproj Rds, ___ 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] cmake 2.6: add_custom_command - add_custom_target
Hi cmakers, I decided to start a new project using cmake. While I got a lot of things going quickly, some things are taking me to despair. The current issue has a couple of web hits, but either I misunderstand something critical or cmake 2.6 (as of current Debian Lenny) is broken: --8---CMakeLists.txt cmake_minimum_required(VERSION 2.6) project(test) add_custom_command( OUTPUT bla.txt COMMAND touch bla.txt ) add_custom_target(bla DEPENDS bla.txt) --8---CMakeLists.txt I'd expect this to produce an effective Makefile like this: .phony: bla bla: bla.txt bla.txt: touch bla.txt Well, cmake Makefiles are somewhat more complicated, but it essentially misses the final rule, i.e. typing #~: make bla make[3]: *** Keine Regel vorhanden, um das Target »../bla.txt«, benötigt von »CMakeFiles/bla«, zu erstellen. Schluss. make[2]: *** [CMakeFiles/bla.dir/all] Fehler 2 make[1]: *** [CMakeFiles/bla.dir/rule] Fehler 2 make: *** [bla] Fehler 2 (German translation of: No rule for target: ../bla.txt) Any ideas what is going wrong here? The whole issue arises in my solution to support GNU gettext, where this issue is the 'pot' target boiled down to its bare necessities. Extensive web searches did not reveal any standard gettext solution, did I miss something by the way? Another feature, which I have been missing dearly was propagating variables from subdirs to global scope - I do not want to repeat this propagation on each level. I worked around this by writing all required data to ENV and have a macro in the root CMakeLists.txt produce the variables. It works, but for my taste is unnecessarily complicated and I'm unsure about length constraints on environments. The latter could be mitigated using a file, but that's still far from elegant. Is anyone aware of a smarter solution to define variables in various subdirs and use those in another subdir added later? Thanks for your help, - lars. ___ 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] cmake 2.6: add_custom_command - add_custom_target
On 2010-01-01 01:57+0100 Spicy wrote: Hi cmakers, I decided to start a new project using cmake. While I got a lot of things going quickly, some things are taking me to despair. The current issue has a couple of web hits, but either I misunderstand something critical or cmake 2.6 (as of current Debian Lenny) is broken: --8---CMakeLists.txt cmake_minimum_required(VERSION 2.6) project(test) add_custom_command( OUTPUT bla.txt COMMAND touch bla.txt ) add_custom_target(bla DEPENDS bla.txt) --8---CMakeLists.txt Any ideas what is going wrong here? Yes. replace bla.txt everywhere by ${CMAKE_CURRENT_BINARY_DIR}/bla.txt, and all will be well. I have just checked that works, and also verified the problem you found if you use bla.txt instead. It's possible you might be able to also solve the problem using WORKING_DIRECTORY, but I am not sure about that, and I know ${CMAKE_CURRENT_BINARY_DIR}/bla.txt (i.e., being specific about the path) always does work. Alan __ Alan W. Irwin Astronomical research affiliation with Department of Physics and Astronomy, University of Victoria (astrowww.phys.uvic.ca). Programming affiliations with the FreeEOS equation-of-state implementation for stellar interiors (freeeos.sf.net); PLplot scientific plotting software package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project (lbproject.sf.net). __ Linux-powered Science __ ___ 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