(no subject)

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

(no subject)

Johan Knutzen
Hi!

What is the status of scripts enabling precompiled headers for gcc/visual studio? I've tried out PCHSupport_26 from http://www.cmake.org/Bug/view.php?id=1260 but I couldn't get it to work. Does anyone have any up to date script that works with 2.8?


Johan


Ta semester! - sök efter resor hos Kelkoo.
Jämför pris på flygbiljetter och hotellrum: http://www.kelkoo.se/c-169901-resor-biljetter.html

_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: (no subject)

John Drescher-2
On Tue, Dec 15, 2009 at 4:13 AM, Johan Knutzen <[hidden email]> wrote:
>
> Hi!
>
> What is the status of scripts enabling precompiled headers for gcc/visual studio? I've tried out PCHSupport_26 from http://www.cmake.org/Bug/view.php?id=1260 but I couldn't get it to work. Does anyone have any up to date script that works with 2.8?
>

I have not bothered in linux since I can use ccache to speed up
builds. In windows I use the following macro:

#########################################################################################

macro( SM_PCH_SUPPORT ProjectName )
if (MSVC)
        if (USE_MSVC_PCH)
       
                set_source_files_properties(${ProjectName}PCH.cxx
                        PROPERTIES
                        COMPILE_FLAGS "/Yc${ProjectName}PCH.h"
                        )
                foreach( src_file ${${ProjectName}_SRCS} )
                        set_source_files_properties(
                                ${src_file}
                                PROPERTIES
                                COMPILE_FLAGS "/Yu${ProjectName}PCH.h"
                                )
                endforeach( src_file ${${ProjectName}_SRCS} )
               
                list(APPEND ${ProjectName}_SRCS ${ProjectName}PCH.cxx)
                list(APPEND ${ProjectName}_EXT_HDRS ${ProjectName}PCH.h)

        endif(USE_MSVC_PCH)
endif (MSVC)
endmacro (SM_PCH_SUPPORT)

#########################################################################################


And this requires me to have my source variable named ${ProjectName}_SRCS

And my header variable to be named ${ProjectName}_EXT_HDRS

and the following files to exist in the same folder as the CMakeLists.txt

${ProjectName}PCH.cxx ${ProjectName}PCH.h

I generally put this macro in the main project before my first
add_subdirectory so that all subprojects can use the macro as well.

Then to activate this in a project. I place the macro call after I
define the list variables.

SET( smDataManagement_SRCS
        ./src/smData.cxx
        ./src/smDataOperation.cxx
        ./src/smCounterBalanceOperation.cxx
)

SET( smDataManagement_EXT_HDRS
        ./Include/smData.h
        ./Include/smDataOperation.h
        ./Include/smCounterBalanceOperation.h
)

SET( smDataManagement_MOC_HDRS
       
)

# some .ui files
SET( smDataManagement_UIS
)

# and finally an resource file
SET( smDataManagement_RCS
)

SET( smDataManagement_INT_HDRS

)

#Add precompiled header support
SM_PCH_SUPPORT(smDataManagement)

This works in cmake-2.6 and above.
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
Reply | Threaded
Open this post in threaded view
|

Re: (no subject)

Johan Knutzen
Hi John,

Thank you! This looks very nice, and uses a bit different approach than the one used in PCHSupport.

Will use this!

Johan

--- Den tis 2009-12-15 skrev John Drescher <[hidden email]>:

Från: John Drescher <[hidden email]>
Ämne: Re: [CMake] (no subject)
Till: "Johan Knutzen" <[hidden email]>
Kopia: [hidden email]
Datum: tisdag 15 december 2009 15.08

On Tue, Dec 15, 2009 at 4:13 AM, Johan Knutzen <knutzen_johan2@...> wrote:
>
> Hi!
>
> What is the status of scripts enabling precompiled headers for gcc/visual studio? I've tried out PCHSupport_26 from http://www.cmake.org/Bug/view.php?id=1260 but I couldn't get it to work. Does anyone have any up to date script that works with 2.8?
>

I have not bothered in linux since I can use ccache to speed up
builds. In windows I use the following macro:

#########################################################################################

macro( SM_PCH_SUPPORT ProjectName )
if (MSVC)
    if (USE_MSVC_PCH)
   
        set_source_files_properties(${ProjectName}PCH.cxx
            PROPERTIES
            COMPILE_FLAGS "/Yc${ProjectName}PCH.h"
            )
        foreach( src_file ${${ProjectName}_SRCS} )
            set_source_files_properties(
                ${src_file}
                PROPERTIES
                COMPILE_FLAGS "/Yu${ProjectName}PCH.h"
                )
        endforeach( src_file ${${ProjectName}_SRCS} )
       
        list(APPEND ${ProjectName}_SRCS ${ProjectName}PCH.cxx)
        list(APPEND ${ProjectName}_EXT_HDRS ${ProjectName}PCH.h)

    endif(USE_MSVC_PCH)
endif (MSVC)
endmacro (SM_PCH_SUPPORT)

#########################################################################################


And this requires me to have my source variable named ${ProjectName}_SRCS

And my header variable to be named ${ProjectName}_EXT_HDRS

and the following files to exist in the same folder as the CMakeLists.txt

${ProjectName}PCH.cxx ${ProjectName}PCH.h

I generally put this macro in the main project before my first
add_subdirectory so that all subprojects can use the macro as well.

Then to activate this in a project. I place the macro call after I
define the list variables.

SET( smDataManagement_SRCS
    ./src/smData.cxx
    ./src/smDataOperation.cxx
    ./src/smCounterBalanceOperation.cxx
)

SET( smDataManagement_EXT_HDRS
    ./Include/smData.h
    ./Include/smDataOperation.h
    ./Include/smCounterBalanceOperation.h
)

SET( smDataManagement_MOC_HDRS
   
)

# some .ui files
SET( smDataManagement_UIS
)

# and finally an resource file
SET( smDataManagement_RCS
)

SET( smDataManagement_INT_HDRS

)

#Add precompiled header support
SM_PCH_SUPPORT(smDataManagement)

This works in cmake-2.6 and above.
John


Ta semester! - sök efter resor hos Kelkoo.
Jämför pris på flygbiljetter och hotellrum: http://www.kelkoo.se/c-169901-resor-biljetter.html

_______________________________________________
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