[CMake] Testing and DLLs

Hauke Heibel hauke.heibel at googlemail.com
Wed May 4 14:24:58 EDT 2011


I forgot to reply to all.

The gist is that I did override the output directories in some
sub-modules. I.e. setting CMAKE_*_OUTPUT_DIRECTORY is really all I
need.

- Hauke

On Wed, May 4, 2011 at 6:26 PM, Michael Jackson
<mike.jackson at bluequartz.net> wrote:
> Are you talking about the actual library/DLL that you are creating or some 3rd party library that your built library depends on? If you do this:
>
> # ---------- Setup output Directories -------------------------
> SET (CMAKE_LIBRARY_OUTPUT_DIRECTORY
>  ${PROJECT_BINARY_DIR}/Bin
>  CACHE PATH
>  "Single Directory for all Libraries"
>  )
>
> # --------- Setup the Executable output Directory -------------
> SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY
>  ${PROJECT_BINARY_DIR}/Bin
>  CACHE PATH
>  "Single Directory for all Executables."
>  )
>
> # --------- Setup the Executable output Directory -------------
> SET (CMAKE_ARCHIVE_OUTPUT_DIRECTORY
>  ${PROJECT_BINARY_DIR}/Bin
>  CACHE PATH
>  "Single Directory for all static libraries."
>  )
>
> All the libraries and executables should be built into the same location?
> ___________________________________________________________
> Mike Jackson                      www.bluequartz.net
> Principal Software Engineer       mike.jackson at bluequartz.net
> BlueQuartz Software               Dayton, Ohio
>
> On May 4, 2011, at 11:46 AM, Hauke Heibel wrote:
>
>> Hi,
>>
>> I am curious whether there is a common way of dealing with unit tests
>> when the actual project to be tested is a DLL? The issue I am facing
>> is a common Windows issue where the required DLL is not found in the
>> path.
>>
>> I tried to put all binaries in the same directory by modifying
>> CMAKE_*_OUTPUT_DIRECTORY but that did not affect my tests (added via
>> add_test).
>>
>> Another solution I can think of is running "make INSTALL" before
>> running the tests but that feels like a strange approach since I
>> typically want to test before installing.
>>
>> Its also not really possible to adapt the PATH environment variable -
>> how could I possible guess where somebody is going to build my code!?
>>
>> So again, I am really curious if there is a well working solution.
>>
>> Regards,
>> Hauke
>> _______________________________________________
>> 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
>
>


More information about the CMake mailing list