[CMake] option, configure_file and ON/OFF
Hello, I am trying to use a UI option to set a value used in configure_file and ideally obtain a file that doesn't use ON/OFF. Here is a CMake sample: option (MYLIB_HAS_WHATEVER "Use whatever library" OFF) In my config.h.in I have: #define ON 1 #define OFF 0 #define MYLIB_HAS_WHATEVER ${MYLIB_HAS_WHATEVER} Then in my code I can use: #if MYLIB_HAS_WHATEVER #endif It worked so far but there is an issue if we end up using other libraries which also define ON and/or OFF. There seems to be no way to tell CMake to use 1/0 instead of ON/OFF during the configure_file. My solution has been to modify my CMake to do the following: option (MYLIB_HAS_WHATEVER "Use whatever library" OFF) if (MYLIB_HAS_WHATEVER) set(MYLIB_CONFIG_HAS_WHATEVER 1) else (MYLIB_HAS_WHATEVER) set(MYLIB_CONFIG_HAS_WHATEVER 0) endif (MYLIB_HAS_WHATEVER) and in the config.h.in do: #define MYLIB_HAS_WHATEVER ${MYLIB_CONFIG_HAS_WHATEVER} Is there a better way? Anton --- Anton Deguet, Research Engineer, ERC-CISST/LCSR, Johns Hopkins University e-mail: anton.deg...@jhu.edu, iChat: anton.deg...@mac.com phone: 410-790-0456 JHU, LCSR, Hackerman Hall 137b, 3400 North Charles Street, Baltimore, MD 21218, USA ___ 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] find_package with config file always set xyz_FOUND to true?
Hello, I am trying to use the following syntax: find_package (xyz REQUIRED xyz1 xyz2) using a config file, i.e. NOT Findxyz.cmake. I have a file named xyz-config.cmake that contains some code to check if the required components are available or not (based on how xyz was compiled). Ideally I would like the find_package command to set xyz_FOUND to false if: - xyz-config.cmake file is not found (that's working by default) OR - xyz-config.cmake file is found BUT one or more component is missing In my xyz-config.cmake, I tried: - set (xyz_FOUND FALSE) # overall package not found as required - set (xyz2_FOUND FALSE) # component not found, hoping find_package would compare this to the list xyz_FIND_COMPONENTS But in all cases, it seems that find_package resets xyz_FOUND to 1 as long as the file xyz-config.cmake is found. Is there a way to set xyz_FOUND to 0 within xyz-config.cmake? Anton ___ 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] Second post: find_package with config file always set xyz_FOUND to true?
Hello, I haven't heard anything following my previous post. Is there any chance someone could provide some guidance? Sincerely, Anton On Aug 29, 2011, at 6:02 PM, Anton Deguet wrote: > Hello, > > I am trying to use the following syntax: > find_package (xyz REQUIRED xyz1 xyz2) using a config file, i.e. NOT > Findxyz.cmake. > > I have a file named xyz-config.cmake that contains some code to check if the > required components are available or not (based on how xyz was compiled). > Ideally I would like the find_package command to set xyz_FOUND to false if: > - xyz-config.cmake file is not found (that's working by default) > OR > - xyz-config.cmake file is found BUT one or more component is missing > > In my xyz-config.cmake, I tried: > - set (xyz_FOUND FALSE) # overall package not found as required > - set (xyz2_FOUND FALSE) # component not found, hoping find_package would > compare this to the list xyz_FIND_COMPONENTS > > But in all cases, it seems that find_package resets xyz_FOUND to 1 as long as > the file xyz-config.cmake is found. Is there a way to set xyz_FOUND to 0 > within xyz-config.cmake? > > Anton > > ___ 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] Second post: find_package with config file always set xyz_FOUND to true?
Hi Michael, Sorry, I mistakenly trashed your previous answer, thank you for both replies. It looks like I am not the first one to raise that question. If I understand well, the primary issue is to agree on the semantic of: find_package (xyz COMPONENTS c1 c2) if (xyz_FOUND) … xyz_FOUND can mean: - xyz has been found and since you asked for components c1 and c2, please check the variables xyz_c1_FOUND and xyz_c2_FOUND to see if these components are available - xyz has been found along with c1 and c2 I would personally prefer the second approach as it makes it easy to test if everything has been found as required. Maybe there is yet another variable to indicate that all components have been found, say xyz_FOUND_AS_REQUIRED. That would allow users to write simpler code: if (xyz_FOUND AND xyz_c1_FOUND AND xyz_c2_FOUND) would become: if (xyz_FOUND_AS_REQUIRED) Ultimately I will stick to the recommended approach. The second aspect of the issue (and this is what I initially encountered) is the different behavior of find_package for either a module find or a config file. I wrote a CMake file/scripts that sets xyz_FOUND and used it for both cases, i.e. installed it as either Findxyz.cmake or xyz-config.cmake. It was a bit disconcerting to have my xyz_FOUND variable overwritten in one case and not the other. I understand that this is strongly tied to the defined/accepted meaning of xyz_FOUND and I was apparently mis-using it. But ... maybe … the find_package could be slightly modified: - send a warning to the user (developer message) if the variable xyz_FOUND is modified/set by the file xyz-config.cmake - more subtle and might have implications I don't foresee, if after loading the file xyz-config.cmake find_package realizes that xyz_FOUND has been set, let it as is. That would allow me to keep using xyz_FOUND incorrectly :-) Again, thank you for your answer. Anton On Sep 19, 2011, at 2:21 PM, Michael Hertling wrote: > On 09/19/2011 07:09 PM, Anton Deguet wrote: >> Hello, >> >> I haven't heard anything following my previous post. Is there any chance >> someone could provide some guidance? >> >> Sincerely, >> >> Anton >> >> On Aug 29, 2011, at 6:02 PM, Anton Deguet wrote: >> >>> Hello, >>> >>> I am trying to use the following syntax: >>> find_package (xyz REQUIRED xyz1 xyz2) using a config file, i.e. NOT >>> Findxyz.cmake. >>> >>> I have a file named xyz-config.cmake that contains some code to check if >>> the required components are available or not (based on how xyz was >>> compiled). Ideally I would like the find_package command to set xyz_FOUND >>> to false if: >>> - xyz-config.cmake file is not found (that's working by default) >>> OR >>> - xyz-config.cmake file is found BUT one or more component is missing >>> >>> In my xyz-config.cmake, I tried: >>> - set (xyz_FOUND FALSE) # overall package not found as required >>> - set (xyz2_FOUND FALSE) # component not found, hoping find_package would >>> compare this to the list xyz_FIND_COMPONENTS >>> >>> But in all cases, it seems that find_package resets xyz_FOUND to 1 as long >>> as the file xyz-config.cmake is found. Is there a way to set xyz_FOUND to >>> 0 within xyz-config.cmake? >>> >>> Anton > > Second try: http://www.mail-archive.com/cmake@cmake.org/msg37840.html > > Regards, > > Michael > ___ > 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
[CMake] Tips to create a UseXYZ.cmake
Hello, Besides digging in the existing UseVTK, UseITK, UseOpenIGTLing, ... is there a short description of the philosophy and basic commands to use? Any pointer is welcome. This would be for a project with multiple external dependencies, i.e. libxml, openCV, Python, numpy, ... Thanks, Anton --- Anton Deguet, Research Engineer, ERC-CISST/LCSR, Johns Hopkins University e-mail: anton.deg...@jhu.edu, iChat: anton.deg...@mac.com office phone: 410-516-5261, cell phone: 410-790-0456 JHU, LCSR, CSEB 137b, 3400 North Charles Street, Baltimore, MD 21218, USA ___ 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] How to figure out when a feature was added
Hello, I am trying to find all release notes for CMake. I am currently using the if (... VERSION_NEWER ...) and I know that it has not always been available and would like to avoid downloading all past versions of CMake to figure out when it was added to have the correct "CMAKE_MINIMUM_REQUIRED(VERSION 2.6.x)". Is there an online list of feature/date of introduction or a way to access all release notes? Anton --- Anton Deguet, Research Engineer, ERC-CISST/LCSR, Johns Hopkins University e-mail: anton.deg...@jhu.edu, iChat: anton.deg...@mac.com office phone: 410-516-5261, cell phone: 410-790-0456 JHU, LCSR, CSEB 137b, 3400 North Charles Street, Baltimore, MD 21218, USA ___ 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] Removing an option created with OPTION?
Hello, I have a build designed to show new options based on the user's choice. E.g. when the user decides to compile the examples, a long list of possible examples to compile appears with an ON/OFF choice. Now when the user decides to not compile the examples, the list of options created with the cmake command "OPTION" still appears. That make sense as this variables are still in the cache. Is there any way to remove these options automatically and "un-clutter" the cmake UI (using ccmake or cmakesetup)? Thanks, Anton --- Anton Deguet, Research Engineer, ERC-CISST, Johns Hopkins University [EMAIL PROTECTED], Office: 410-516-5261, Cell: 410-790-0456 iChat only: [EMAIL PROTECTED] ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
[CMake] Activating coverage with ctest
Hello, I feel like this is a simple question but I can't figure out the answer. When I try to use ctest -DExperimentalCoverage, I get: cisst> ctest -D ExperimentalCoverage Site: Macintosh.local Build name: Darwin-g++-4.0.1--CoVeNuInOs-Py-CNe Performing coverage Cannot find any coverage files. Is there something specific to add in my DartConfig.cmake? What I currently have is: # Options for Dart2 SET(DROP_METHOD "xmlrpc") SET(DROP_SITE "http://lacuna.cs.jhu.edu:8081";) SET(DROP_LOCATION "cisst") SET(COMPRESS_SUBMISSION ON) # the specified NIGHLY_START_TIME. Time is specified in 24 hour format. SET (NIGHTLY_START_TIME "01:00:00 EDT") # Coverage SET(CTEST_COVERAGE_COMMAND ${COVERAGE_COMMAND}) Anton ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Activating coverage with ctest
Thanks to both you and Xavier, I had seen this FAQ but I was wandering if there was a way to have this somewhat automated using CMake. I played a bit with my DartConfig.cmake and I now have: IF(CMAKE_COMPILER_IS_GNUCXX) SET(CTEST_COVERAGE_COMMAND ${COVERAGE_COMMAND}) SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -ftest-coverage -fprofile-arcs") SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -ftest-coverage -fprofile-arcs") SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -ftest-coverage -fprofile-arcs") LINK_LIBRARIES(gcov) ENDIF(CMAKE_COMPILER_IS_GNUCXX) This seems to work but I have a few pending questions: -1- Does this make any sense anyway? -2- In the FAQ, you don't have a linker option to specify -lgcov. Is this normal? -3- The tests seem much slower. Before I dig in the gcc documentation, is this to be expected? -4- This one should probably be in a different thread, but if I try to build a shared library on Mac OS X using the makefile generator I get the following error: ld: common symbols not allowed with MH_DYLIB output format with the -multi_module option /usr/lib/gcc/powerpc-apple-darwin8/4.0.1/libgcov.a(_gcov.o) definition of common ___gcov_var (size 4128) /usr/bin/libtool: internal link edit command failed Any clue? Anton - Original Message - From: Andy Cedilnik <[EMAIL PROTECTED]> Date: Wednesday, January 18, 2006 2:56 pm Subject: Re: [CMake] Activating coverage with ctest > Hi Anton, > > Please check the CTest FAQ: > > http://www.cmake.org/Wiki/CTest:FAQ#How_can_I_perform_coverage_test.3F > > Andy > > ANTON DEGUET wrote: > > >Hello, > > > >I feel like this is a simple question but I can't figure out the > answer. When > >I try to use ctest -DExperimentalCoverage, I get: > > > >cisst> ctest -D ExperimentalCoverage > > Site: Macintosh.local > > Build name: Darwin-g++-4.0.1--CoVeNuInOs-Py-CNe > >Performing coverage > > Cannot find any coverage files. > > > >Is there something specific to add in my DartConfig.cmake? > > > >What I currently have is: > ># Options for Dart2 > >SET(DROP_METHOD "xmlrpc") > >SET(DROP_SITE "http://lacuna.cs.jhu.edu:8081";) > >SET(DROP_LOCATION "cisst") > >SET(COMPRESS_SUBMISSION ON) > > > ># the specified NIGHLY_START_TIME. Time is specified in 24 hour > format.>SET (NIGHTLY_START_TIME "01:00:00 EDT") > > > ># Coverage > >SET(CTEST_COVERAGE_COMMAND ${COVERAGE_COMMAND}) > > > > > >Anton > > > >___ > >CMake mailing list > >CMake@cmake.org > >http://www.cmake.org/mailman/listinfo/cmake > > > > > > > -- > Andy Cedilnik > Kitware Inc. > ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
[CMake] Set environment variables for a custom command
Hello, Is it possible to define some environment variables for each ADD_CUSTOM_COMMAND / POST_BUILD? In my case, I compile and build a single test driver for multiple test cases. Once the test driver is compiled, CMake automatically run it with a special option to generate a list of test cases compatible with CTest. I am running into two problems with this post built target: -1- On Windows, I am using DLLs and these DLLs are not in the same directory. Furthermore, I have some Debug DLLs and some Release DLLs therefore I would need some kind of PATH=/myPathToLibs/$(IntDir) (for MS Visual Studio only). On Unix, I am currently using rpath even thought I believe that a solution based on LD_LIBRARY_PATH would be better. -2- My test program also requires to set PYTHONPATH. Again, my SWIG generated code is compiled in Release/Debug mode therefore I would like this variable to be defined using $(IntDir). Since our code is currently supported on Linux (gmake/gcc, gmake/icc), Windows (MS Visual Studio, MS nmake) and Mac OS X (gmake/gcc, XCode/gcc), I need a portable solution able to handle multiple configurations. Is there such a thing as: ADD_CUSTOM_COMMAND(TARGET ... POST_BUILD COMMAND ... ARGS ... ENV varName varValue [APPEND] ...) I would use it as: ADD_CUSTOM_COMMAND(TARGET myExec POST_BUILD COMMAND myExec ARGS -CTestList ENV PATH ${LIBRARY_OUTPUT_PATH}/${CMAKE_CFG_INTDIR} APPEND ENV PYTHONPATH ${MY_PYTHON_PATH}/${CMAKE_CFG_INTDIR} APPEND ) Thank you, Anton Deguet -- Anton Deguet <[EMAIL PROTECTED]> ERC CISST Johns Hopkins University ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
[CMake] Different LIBRARY_OUTPUT_PATH
I am having some problems with a project for which I defined different LIBRARY_OUTPUT_PATH. Basically, I have a default LIBRARY_OUTPUT_PATH defined in my root CMakeLists.txt and, in a subdirectory "examples", I have a new definition of LIBRARY_OUTPUT_PATH so that all the libraries related to my examples programs go in a different place. On Windows with .net 2003, this works fine. On linux, with gmake, I can configure but at compilation time I get the error: make[3]: *** No rule to make target `examples/lib/libcisstCommon.a', needed by `examples/bin/errorHandling'. Stop. This is simply because "libcisstCommon.a" is actually compiled and stored as `lib/libcisstCommon.a` as defined in the root CMakeLists.txt. So, am I allowed to redefine LIBRARY_OUTPUT_PATH, and if not, how can I specify that I want some libraries in one directory and others in another directory? Sincerely, Anton Deguet -- Anton Deguet <[EMAIL PROTECTED]> ERC CISST Johns Hopkins University ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Different LIBRARY_OUTPUT_PATH
Indeed, the CVS version seems behave as I expected under linux/gmake. Since we do release our code to the public and I can't really require all potential users to checkout the CVS version of CMake, the usual question is: Is there any timeline for the next release of CMake? Anton On Mon, 2006-03-06 at 14:53 -0500, Brad King wrote: > In CMake 2.2 (current release) and earlier one is only allowed a single > LIBRARY_OUTPUT_PATH for the entire build tree. I think the CVS version > of CMake allows a per-directory setting but a test for the feature has > not yet been written. > > -Brad -- Anton Deguet <[EMAIL PROTECTED]> ERC CISST Johns Hopkins University ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Fwd: CMAKE + SWIG + more wrapped languages
Daniel, I figured out a solution which is more a trick than anything else. Basically, I created an empty .i file as a stub for each language. For example, you have Module.i and you could add ModulePython.i which contains: %include "Module.i". I then use CMake with these stubs. This works but I then run into a long known issue with the CMake SWIG macro, i.e. the dependencies don't handle files included by SWIG using the %include. I believe there is a ticket opened for this issue. Anton - Original Message - From: Daniel Tihelka <[EMAIL PROTECTED]> Date: Monday, July 24, 2006 4:47 am Subject: [CMake] Fwd: CMAKE + SWIG + more wrapped languages > > Hallo everybody. > > May I ask you for a help with SWIG module in CMake? I need to > create more > wrapping libraries from one set of .i SWIG files. To use SWIG from > CMake is > really trivial for one wrapped language, but I need to create more > wrappersin one step, as illustrated below: > > I have directory structure like this: > > wrap > | > +-- Module.i > +-- *.i (other SWIG interface files included by Module.i) > | > +-- python > +-- perl > +-- java > > The "wrap/CMakeLists.txt" looks simple: > > SUBDIRS(python perl java) > > > And for example "wrap/python/CMakeLists.txt" looks like (the > CMakeLists will > look similarly for "perl" and "java" packages): > > # Find and include required packages > FIND_PACKAGE( SWIG REQUIRED ) > FIND_PACKAGE( PythonLibs REQUIRED ) > INCLUDE( ${SWIG_USE_FILE} ) > > # Set include python path > INCLUDE_DIRECTORIES( ${PYTHON_INCLUDE_PATH} ) > > # Generated file is C++, tell it to SWIG > SET_SOURCE_FILES_PROPERTIES( Module.i PROPERTIES CPLUSPLUS ON ) > > # ! Tell to SWIG that .i files are one directory up ! > SET_SOURCE_FILES_PROPERTIES( Module.i PROPERTIES SWIG_FLAGS "-I../") > > # Create wrapper > SWIG_ADD_MODULE( module python Module.i ) > SWIG_LINK_LIBRARIES( module python2.4 ) > > # Copy the generated files as post-build step > ADD_CUSTOM_COMMAND( TARGET ${SWIG_MODULE_module_REAL_NAME} >POST_BUILD >COMMAND ${CMAKE_COMMAND} >ARGS -E copy > ${CMAKE_CURRENT_BINARY_DIR}/*.py${CMAKE_CURRENT_SOURCE_DIR} ) > # > ADD_CUSTOM_COMMAND( TARGET${SWIG_MODULE_module_REAL_NAME} >POST_BUILD >COMMAND ${CMAKE_COMMAND} >ARGS -E copy > ${CMAKE_CURRENT_BINARY_DIR}/*.so${CMAKE_CURRENT_SOURCE_DIR} ) > > > > > However, when the build process is started, it finishes by error: > > make[5]: Entering directory `/home//build//wrap/python' > make[5]: *** No rule to make target > `/home//wrap/python/Module.i', needed by > `/home//build//wrap/python/Module_wrap.c'. Stop. > > > When I looked at ".../build/python/Makefile", there is target: > > /home//build//wrap/python/Module_wrap.c: > /home//wrap/python/Module.i @echo "Building Swig > source /home//build/wrap/python/Module_wrap.c..." > /usr/bin/swig -python -I/usr/include/python2.4 -o > /home//build//wrap/python/Module_wrap.c > /home//wrap/python/Module.i > However, there is no "-I../" switch specified by > "SET_SOURCE_FILES_PROPERTIES( Module.i PROPERTIES SWIG_FLAGS "- > I../")". Moreover, there is absolute path to the "Module.i" which > is, however, wrong. > When I tries to call SWIG directly, but only with Module.i it was > OK - the > -I switch seems to ensure the right path. > > I have also tried to set "relative paths" during CMake > configuration, but it > leaded to other errors during the build. > > Could someone give me a hint how to solve this problem? Did I > choose the > right approach, or should it be solved in different way? Or how to > instruct CMake not to use the whole path to .i file (neither > absolute, nor relative)? > Any help will really be appreciated. > > Thank you very much, > Dan > > ___ > 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
[CMake] CTest and devenv command line issues
Hello, I am trying to setup a couple of nightly builds on a single Windows box. Since the build requires DLLs (to test our __declspec and Python wrappers), I have been trying to use the MSVC devenv command line with /useenv to set the DLL and Python search paths per build. I have something almost working but I am stuck whenever I try to submit to Dart. Here is what works (in a small batch script): @rem Go to the build directory c: cd "C:\users\anton\dart-build\msvc7.1-dynamic-IDE\build" @rem Set the env. variables. call cisstvsvars.bat call cisstvars.bat Release @rem Clean and build devenv /useenv /clean Release /project ALL_BUILD devenv /useenv /build Release /project ALL_BUILD devenv /useenv /build Release /project RUN_TESTS At that point, my test programs can find the DLLs and run successfully but, as expected, nothing gets submitted to my Dart2 dashboard. The following two won't work: devenv /useenv /build Release /project Nightly "C:\Program Files\CMake 2.4\bin\ctest.exe" -C Release -D Nightly The error message is that the DLLs are not found. I looks like at one point my environment variables have been dropped. Any clue? I am using CMake 2.4.2. Anton -- Anton Deguet <[EMAIL PROTECTED]> ERC CISST Johns Hopkins University ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] CTest and devenv command line issues
Brad, Thank you for your reply. I finally had a chance to try it and I must admit that I only have a partial success to report. The main issue I have is that I am using a custom command (post build) to generate the list of test cases used by CTest. So, what happens is that within the IDE/devenv, I need to have the paths set for my Dlls and Python libraries. My partial solution so far is to compile using devenv with /useenv and then use a CTest script for the submission. This seems to work: @rem Go to the build directory c: cd "C:\users\anton\dart-build\msvc7.1-dynamic-IDE\build" @rem Set the env. variables. call cisstvsvars.bat call cisstvars.bat Release @rem Clean and build devenv /useenv /clean Release /project ALL_BUILD devenv /useenv /build Release /project ALL_BUILD "C:\Program Files\CMake 2.4\bin\ctest.exe" -C Release -S script.cmake This solution is only partial because ctest will not handle the compilation and therefore will not report any compiler error to Dart. Without the ctest script I could not submit. With it I can now submit but I still can't compile, i.e. it looks like the PATH I set using SET(CTEST_ENVIRONMENT ...) is not passed properly to devenv ... Any thoughts? Anton On Tue, 2006-07-25 at 16:00 -0400, Brad King wrote: > Anton Deguet wrote: > > Hello, > > > > I am trying to setup a couple of nightly builds on a single Windows box. > > Since the build requires DLLs (to test our __declspec and Python > > wrappers), I have been trying to use the MSVC devenv command line > > with /useenv to set the DLL and Python search paths per build. I have > > something almost working but I am stuck whenever I try to submit to > > Dart. Here is what works (in a small batch script): > > > > @rem Go to the build directory > > c: > > cd "C:\users\anton\dart-build\msvc7.1-dynamic-IDE\build" > > > > @rem Set the env. variables. > > call cisstvsvars.bat > > call cisstvars.bat Release > > > > @rem Clean and build > > devenv /useenv /clean Release /project ALL_BUILD > > devenv /useenv /build Release /project ALL_BUILD > > devenv /useenv /build Release /project RUN_TESTS > > > > At that point, my test programs can find the DLLs and run successfully > > but, as expected, nothing gets submitted to my Dart2 dashboard. > > > > The following two won't work: > > devenv /useenv /build Release /project Nightly > > "C:\Program Files\CMake 2.4\bin\ctest.exe" -C Release -D Nightly > > > > The error message is that the DLLs are not found. I looks like at one > > point my environment variables have been dropped. > > > > Any clue? I am using CMake 2.4.2. > > This doesn't work because building the Nightly target just runs another > ctest that constructs its own devenv command line to drive the build and > doesn't add the /useenv option. > > CTest is designed to drive dashboard submissions using "ctest -S" > scripts. See here for an example: > > http://www.cmake.org/Testing/Sites/dash4.kitware/Win32-bcc5.8/20060725-1514-Experimental/Notes.html > > You can set environment variables in the script: > > SET(ENV{VAR1} "value1") > SET(ENV{VAR2} "value2") > > -Brad -- Anton Deguet <[EMAIL PROTECTED]> ERC CISST Johns Hopkins University ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
[CMake] How to read a registry key?
Hello, I have found that using EXEC_PROGRAM with ${CMAKE_COMMAND} -E I can write/remove a key in the Windows registry but I haven't figured out how to read a key. Is there a simple solution for that? Anton -- Anton Deguet <[EMAIL PROTECTED]> ERC CISST Johns Hopkins University ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] How to read a registry key?
Bill, I had some success with the key expansion but I haven't been able to do what I need. Basically, I would like to get the un-expanded content of the user path, i.e. not the expanded path (user and system) which can be found using $ENV{PATH}. I tried the following code, i.e. adding two variables, one using the other: SET(CISST_PATH ${EXECUTABLE_OUTPUT_PATH} ${LIBRARY_OUTPUT_PATH}) SET(CISST_PATH_REG_KEY "HKEY_CURRENT_USER\\Environment;CISST_PATH") EXEC_PROGRAM(${CMAKE_COMMAND} ARGS "-E write_regv \"${CISST_PATH_REG_KEY}\" \"${CISST_PATH}\"") SET(OTHER_PATH_REG_KEY "HKEY_CURRENT_USER\\Environment;OTHER_PATH") SET(OTHER_PATH "c:/prg;%CISST_PATH%") EXEC_PROGRAM(${CMAKE_COMMAND} ARGS "-E write_regv \"${OTHER_PATH_REG_KEY}\" \"${OTHER_PATH}\"") GET_FILENAME_COMPONENT(TMP "[HKEY_CURRENT_USER\ \Environment;OTHER_PATH]/dummy.dum" PATH) MESSAGE("${TMP}") At that point, everything looks great and I can check the results with "reg.exe", the expansion works ... Now, if I try to retrieve the user path using GET_FILENAME_COMPONENT(TMP "[HKEY_CURRENT_USER\ \Environment;PATH]/dummy.dum" PATH) TMP is set to "/registry" ... Any explanation or better solution to just retrieve the value as a string? On Wed, 2006-09-06 at 20:55 -0400, William A. Hoffman wrote: > At 05:36 PM 9/6/2006, Anton Deguet wrote: > >Hello, > > > >I have found that using EXEC_PROGRAM with ${CMAKE_COMMAND} -E I can > >write/remove a key in the Windows registry but I haven't figured out how > >to read a key. Is there a simple solution for that? > > Sure, but it seems not to be documented > Several commands including GET_FILENAME_COMPONENT will expand things > like this: > > "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development > Kit\\2.0;JavaHome]/bin" > > You can use this to read registry values. I will add some docs in > the morning. > > -Bill > > ___ > CMake mailing list > CMake@cmake.org > http://www.cmake.org/mailman/listinfo/cmake -- Anton Deguet <[EMAIL PROTECTED]> ERC CISST Johns Hopkins University ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] How to read a registry key?
I looks like this has something to do with the nature of the key/value. For values listed as REG_SZ (within regedit.exe), CMake can retrieve the content but for values stored as REG_EXPAND_SZ I systematically get "/registry". I don't know much about the Windows registry but I did a quick survey of different computers/users in the lab and the user path can be either one which makes it difficult to implement a robust solution. Am I the first one to run into this issue? Anton On Thu, 2006-09-07 at 12:13 -0400, Anton Deguet wrote: > Bill, > > I had some success with the key expansion but I haven't been able to do > what I need. Basically, I would like to get the un-expanded content of > the user path, i.e. not the expanded path (user and system) which can be > found using $ENV{PATH}. > > I tried the following code, i.e. adding two variables, one using the > other: > > SET(CISST_PATH ${EXECUTABLE_OUTPUT_PATH} ${LIBRARY_OUTPUT_PATH}) > SET(CISST_PATH_REG_KEY "HKEY_CURRENT_USER\\Environment;CISST_PATH") > EXEC_PROGRAM(${CMAKE_COMMAND} > ARGS "-E write_regv \"${CISST_PATH_REG_KEY}\" > \"${CISST_PATH}\"") > > SET(OTHER_PATH_REG_KEY "HKEY_CURRENT_USER\\Environment;OTHER_PATH") > SET(OTHER_PATH "c:/prg;%CISST_PATH%") > EXEC_PROGRAM(${CMAKE_COMMAND} > ARGS "-E write_regv \"${OTHER_PATH_REG_KEY}\" > \"${OTHER_PATH}\"") > > GET_FILENAME_COMPONENT(TMP "[HKEY_CURRENT_USER\ > \Environment;OTHER_PATH]/dummy.dum" PATH) > > MESSAGE("${TMP}") > > At that point, everything looks great and I can check the results with > "reg.exe", the expansion works ... > > Now, if I try to retrieve the user path using > GET_FILENAME_COMPONENT(TMP "[HKEY_CURRENT_USER\ > \Environment;PATH]/dummy.dum" PATH) > > TMP is set to "/registry" ... Any explanation or better solution to > just retrieve the value as a string? > > > On Wed, 2006-09-06 at 20:55 -0400, William A. Hoffman wrote: > > At 05:36 PM 9/6/2006, Anton Deguet wrote: > > >Hello, > > > > > >I have found that using EXEC_PROGRAM with ${CMAKE_COMMAND} -E I can > > >write/remove a key in the Windows registry but I haven't figured out how > > >to read a key. Is there a simple solution for that? > > > > Sure, but it seems not to be documented > > Several commands including GET_FILENAME_COMPONENT will expand things > > like this: > > > > "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development > > Kit\\2.0;JavaHome]/bin" > > > > You can use this to read registry values. I will add some docs in > > the morning. > > > > -Bill > > > > ___ > > CMake mailing list > > CMake@cmake.org > > http://www.cmake.org/mailman/listinfo/cmake -- Anton Deguet <[EMAIL PROTECTED]> ERC CISST Johns Hopkins University ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] FindCppUnit
I have the following which works on Unix systems but requires manual input on Windows: # # Find the CppUnit includes and library # # This module defines # CPPUNIT_INCLUDE_DIR, where to find tiff.h, etc. # CPPUNIT_LIBRARIES, the libraries to link against to use CppUnit. # CPPUNIT_FOUND, If false, do not try to use CppUnit. # also defined, but not for general use are # CPPUNIT_LIBRARY, where to find the CppUnit library. # CPPUNIT_DEBUG_LIBRARY, where to find the CppUnit library in debug mode. FIND_PATH(CPPUNIT_INCLUDE_DIR cppunit/TestCase.h /usr/local/include /usr/include ) # With Win32, important to have both IF(WIN32) FIND_LIBRARY(CPPUNIT_LIBRARY cppunit ${CPPUNIT_INCLUDE_DIR}/../lib /usr/local/lib /usr/lib) FIND_LIBRARY(CPPUNIT_DEBUG_LIBRARY cppunitd ${CPPUNIT_INCLUDE_DIR}/../lib /usr/local/lib /usr/lib) ELSE(WIN32) # On unix system, debug and release have the same name FIND_LIBRARY(CPPUNIT_LIBRARY cppunit ${CPPUNIT_INCLUDE_DIR}/../lib /usr/local/lib /usr/lib) FIND_LIBRARY(CPPUNIT_DEBUG_LIBRARY cppunit ${CPPUNIT_INCLUDE_DIR}/../lib /usr/local/lib /usr/lib) ENDIF(WIN32) IF(CPPUNIT_INCLUDE_DIR) IF(CPPUNIT_LIBRARY) SET(CPPUNIT_FOUND "YES") SET(CPPUNIT_LIBRARIES ${CPPUNIT_LIBRARY} ${CMAKE_DL_LIBS}) SET(CPPUNIT_DEBUG_LIBRARIES ${CPPUNIT_DEBUG_LIBRARY} ${CMAKE_DL_LIBS}) ENDIF(CPPUNIT_LIBRARY) ENDIF(CPPUNIT_INCLUDE_DIR) On Wed, 2006-10-04 at 13:28 -0700, Kedzierski, Artur CIV NAVSURFWARCENDIV CORONA wrote: > With CppUnit being popular for unit testing, does > anybody have a FindCppUnit.cmake that would locate it? > > -- > Artur Kedzierski > ___ > CMake mailing list > CMake@cmake.org > http://www.cmake.org/mailman/listinfo/cmake -- Anton Deguet <[EMAIL PROTECTED]> ERC CISST Johns Hopkins University ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
[CMake] Add a .obj file to a library
Hello, I am trying to add a pre-compiled object in a library. I am generating a "solution" for Microsoft Visual Studio .net 2003 using CMake 2.4.5. I used FIND_FILE to locate the ".obj" file and then simply add it to the list of source files for my library. I found a couple of reference on the web related to this problem so I was hopeful. It doesn't work as is because CMake prepends the current source path to my file name (which already contains a full path). So I get a message stating that "C:/current-source-path/C:/path-to-my-obj/ file.obj" can not be found. Is there an easy way to tell CMake to not prepend the current source path? Also, all examples found on the web referred to ".o" files but not ".obj" files. I am pretty sure that CMake can handle this difference but I just wanted verify. Thanks, Anton --- Anton Deguet, Research Engineer, ERC-CISST, Johns Hopkins University [EMAIL PROTECTED], 410-516-5261 ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Add a .obj file to a library
I tried a couple more things. Since the paths were compounded I assumed this was because I could only add files defined with a relative path (wrt the source directory). So I tried to convert the absolute path into a relative path using: FILE(RELATIVE_PATH FILE_IN_RELATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${FILE_IN_ABSOLUTE_PATH}) This works only if the source directory and the directory containing the .obj file are on the same drive. In my case, the obj file in on C: while my source directory is on N: and I don't know if one can define a relative path between two drives on Windows. I there a way to tag a source file as defined with absolute path? Anton On Mar 9, 2007, at 12:15 PM, Anton Deguet wrote: Hello, I am trying to add a pre-compiled object in a library. I am generating a "solution" for Microsoft Visual Studio .net 2003 using CMake 2.4.5. I used FIND_FILE to locate the ".obj" file and then simply add it to the list of source files for my library. I found a couple of reference on the web related to this problem so I was hopeful. It doesn't work as is because CMake prepends the current source path to my file name (which already contains a full path). So I get a message stating that "C:/current-source-path/C:/path-to-my- obj/file.obj" can not be found. Is there an easy way to tell CMake to not prepend the current source path? Also, all examples found on the web referred to ".o" files but not ".obj" files. I am pretty sure that CMake can handle this difference but I just wanted verify. Thanks, Anton --- Anton Deguet, Research Engineer, ERC-CISST, Johns Hopkins University [EMAIL PROTECTED], 410-516-5261 iChat only: [EMAIL PROTECTED] ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
[CMake] ExternalProject_Add always try to connect to SVN server
Hello, I'm wondering if I'm doing something wrong using ExternalProject_Add for a subversion repository. I would expect the following behavior: - First run, see if local copy of code has been checked out. If not 'svn checkout'. Fails if not connected to internet. - Consecutive runs: - if svn local revision different from SVN_REVISION, do a `svn update` to revision specified in ExternalProject_Add - if svn local revision same as requested, do nothing I'm having some issues with the last case, i.e. the code is checked out and 'svn info' tells me I have the desired revision but somehow the build process is still trying to reach the svn server. Since I'm working off the grid, my build fails. Questions: - Did I do something wrong or set an options somewhere that forces CMake to check the SVN server systematically? - Is there an option or command I can set to build when not connected to internet? Sincerely, Anton CMake version: 2.8.12.2 on Ubuntu 14.04 Code: include (ExternalProject) set (cisstJSON_PREFIX cisstJSONExternal) set (CISST_JSON_SVN_REPOSITORY http://svn.code.sf.net/p/jsoncpp/code/trunk/jsoncpp) set (CISST_JSON_SVN_REVISION 276) ExternalProject_Add (cisstJSONExternal PREFIX ${cisstJSON_PREFIX} SVN_REPOSITORY ${CISST_JSON_SVN_REPOSITORY} SVN_REVISION -r ${CISST_JSON_SVN_REVISION} CMAKE_CACHE_ARGS -DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHITECTURES} -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} -DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS} -DOPTION_BUILD_EXAMPLES:BOOL=OFF -DJSONCPP_WITH_TESTS:BOOL=OFF -DJSONCPP_WITH_POST_BUILD_UNITTEST:BOOL=OFF -DCMAKE_INSTALL_PREFIX:FILEPATH=${cisst_BINARY_DIR}/cisstJSON INSTALL_DIR ${cisst_BINARY_DIR}/cisstJSON TIMEOUT 3 ) -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
[CMake] setting executable runtime command line argument
Hello, I am wondering if there is a target property for executable to set a command line argument. I did a bit of googling but I might have missed it. Something like: add_executable (myProgram main.cpp) set_target_properties (myProgram COMMAND_LINE_ARGUMENTS "--verbose --run") This would set the command line options for debugging for most supported IDE (Visual Studio, XCode, ...). Sincerely, Anton -- 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