[CMake] Check directory exists

James Bigler bigler at cs.utah.edu
Thu Jan 31 13:18:28 EST 2008


Oh, that's a different question.  You want this command, then (in the man page).

                 IF(IS_DIRECTORY directory-name)

               True if the given name is a directory.  Behavior  is  well-
               defined only for full paths.

So you probably want something like this:

IF(EXISTS "${dir}" AND IS_DIRECTORY "${dir}")

James

pepone.onrez wrote:
> Yes i read this
> but i want to test if is a directory no a directory or a file
>>
>>
>> On Jan 31, 2008 7:04 PM, James Bigler <bigler at cs.utah.edu> wrote:
>>
>>>  From the man page:
>>>
>>>                 IF(EXISTS file-name)
>>>                 IF(EXISTS directory-name)
>>>
>>>               True  if  the  named file or directory exists.  Behavior
>>> is
>>>               well-defined only for full paths.
>>>
>>>
>>> pepone.onrez wrote:
>>>> There is any way for check if a directory exists using CMake ?
>>>>
>>>> Thanks
>>>>
>>>>
>>>>
>>>>
>>> ------------------------------------------------------------------------
>>>> _______________________________________________
>>>> CMake mailing list
>>>> CMake at cmake.org
>>>> http://www.cmake.org/mailman/listinfo/cmake
>>> _______________________________________________
>>> CMake mailing list
>>> CMake at cmake.org
>>> http://www.cmake.org/mailman/listinfo/cmake
>>>
>>
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake


More information about the CMake mailing list